MrAndrew MrAndrew - 10 days ago 4
CSS Question

Why the navbar isn't fixed?

Why my navbar isn't fixed? I mean why it doesn't come down when I scroll down?

This is the code:



nav {
height: 40px;
width: 100%;
background: #455868;
font-size: 11pt;
font-family: 'PT Sans', Arial, sans-serif;
font-weight: bold;
position: relative;
border-bottom: 2px solid #283744;
}
nav ul {
padding: 0;
margin: 0 auto;
width: 600px;
height: 40px;
}

<nav class="clearfix">
<a href="#" id="pull">Menu</a>
<ul class="clearfix">
<li><a href="#">Home</a></li>
<li><a href="#">How-to</a></li>
<li><a href="#">Icons</a></li>
<li><a href="#">Design</a></li>
<li><a href="#">Web 2.0</a></li>
<li><a href="#">Tools</a></li>
</ul>
</nav>




Answer

Try this :) hope this will be helped to you

  nav {
  height: 40px;
  width: 100%;
  background: #455868;
  font-size: 11pt;
  font-family: 'PT Sans', Arial, sans-serif;
  font-weight: bold;
  position: fixed;
  border-bottom: 2px solid #283744;
}
Comments