I am currently working on building a horizontal navigation bar using CSS.
What puzzles me is that when I specify a width for my ol
tag, the horizontal float function does not seem to cooperate. However, if I remove the width
property, everything works just fine.
Can anyone shed some light on what might be causing this issue?
Here is the CSS code:
nav {
position: absolute;
height: 40px;
width: 100%;
top: 240px;
background-color: #8F8E93;
float: left;
}
nav ol {
width: 300px;
}
nav ol li {
float: left;
}
nav>ol>li>a {
display: block;
}
And here's the HTML snippet:
<nav>
<ol>
<li><a href="reiseziele.html">Reiseziele</a></li>
<li><a href="kontakt.html">Kontakt</a>
<ol>
<li><a href="kontakt_mail.html">E-Mail</a></li>
<li><a href="kontakt_formular.html">Formular</a></li>
</ol>
</li>
</ol>
</nav>