Trying to create a simple navigation bar with horizontal links but facing issues. Can't seem to make it work despite following examples online:
<!-- Navigator -->
<div id="nav">
<ul>
<li><a href="#">Anchor 1</a></li>
<li><a href="#">Anchor 2</a></li>
<li><a href="#">Anchor 3</a></li>
</ul>
</div>
Here's the CSS code snippet provided:
/* Centered on top */
#nav {
margin:0 50%;
position:fixed;
}
#nav ul {
list-style-type:none;
margin:0;
padding:0;
position: absolute;
}
#nav ul li {
float:left;
}
Seems like everything is as expected, but when removing position:fixed from #nav, the navigation won't stay at the top of the viewport. Any insights on what might be going wrong?