我一直在为我的网站构建一个菜单栏,除了每次我尝试调整浏览器宽度进行测试时,我的菜单都会变成一个拥挤在左侧的列表。我尝试添加,display: inline-block
但white-space: nowrap
它不起作用。有任何想法吗?
错误截图:
HTML:
<div id="header" class="row">
<ul class="nav-bar">
<div class="large-2 columns"><li data-slide="1"><a href="">home</a></li></div>
<div class="large-3 columns"><li data-slide="2"><a href="">portfolio</a></li></div>
<div class="large-2 columns"><li class="logo"><img src="images/logo.png" /></li></div>
<div class="large-2 columns"><li data-slide="3"><a href="">about</a></li></div>
<div class="large-3 columns"><li data-slide="4"><a href="">contact</a></li></div>
</ul>
</div>
CSS:
div#header {
width: 960px;
margin: 0 auto;
padding: 0;
color: #FFF;
/*position: relative;*/
top: 0;
}
div#header ul{
height: 128px;
list-style-type: none;
white-space: nowrap;
}
div#header ul li {
display: inline-block;
background-color: #003264;
text-align: center;
height: 128px;
line-height: 128px;
/*padding-left: 15px;
padding-right: 15px;*/
font-size: 36px;
transition: background-color 1s;
-webkit-transition: background-color 1s;
}