我正在设计navigation menu
,但我无法根据窗口调整宽度。我想做menu width 100%
,当我们改变窗口大小时,菜单仍然从左角覆盖到右角。
我用于设计导航的以下代码:
HTML
<nav class="span9">
<!-- Menu-->
<ul id="menu" class="sf-menu">
<li class=""><a href="index.html" class="sf-with-ul">HOME</a></li>
<li><a href="about.html">ABOUT</a></li>
<li><a href="services.html">SERVICES</a></li>
<li class=""><a href="work.html" class="sf-with-ul">WORK</a></li>
<li class=""><a href="blog.html" class="sf-with-ul">BLOG</a></li>
<li class=""><a href="tables_princing.html" class="sf-with-ul">FEATURES</a></li>
<li><a href="contact.html">CONTACT</a></li>
</ul>
<!-- End Menu-->
</nav>
CSS
.sf-menu {
margin: 0;
padding-top: 7px;
}
.sf-menu > li {
position: relative;
float: left;
list-style: none;
line-height: 20px;
margin: 0 40px 0 0;
}
.sf-menu > li > a {
text-decoration: none;
display: block;
font-size: 17px;
}
这里是JSFIDDLE 链接