Home >Web Front-end >HTML Tutorial >The navigation bar is not displayed properly_html/css_WEB-ITnose

The navigation bar is not displayed properly_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:18:491055browse

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;}


Reply to discussion (solution)

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>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn