I want to create a style where the navigation bar is fixed at the top. There is something wrong with the current display, as shown below:
I did not use margin-top, padding-top or the like.
<div id="top_bar"> <div id="nav"> <ul> <li>Login</li> <li>Register</li> </ul> </div></div>
#top_bar{top:0;left:0;right:0;height: 40px;width:100%;position:absolute;background-color: #00CCFF;}#nav{width:960px;height:40px;margin:auto;background-color:#c0c0c0;}ul{height:40px;float:right;margin-right:20px;list-style:none;background-color:#000;}li{height:40px;float:left;margin-left:20px;color:#ffffff;}
No, no one can solve this problem
Is this the effect?
<div id="top_bar"> <div id="nav"> <ul> <li>Login</li> <li>Register</li> </ul> </div></div>