我试图通过使用无序列表创建一个导航菜单,然后让它水平显示。每个 li 中都有一个 div 标签,其中包含更多 div,用于更多样式,但是,列表似乎正在下拉,尽管没有显示任何内容。这是它的 JSFiddle:http: //jsfiddle.net/E8jqN/2/
另外,它的html是:
<div id="header-right">
<ul id="navigation">
<li>
<div class="nav-button">
<div id="schools">
</div>
</div>
<div class="nav-text">
Schools
</div>
</li>
<li>
<div class="nav-button">
<div id="professors">
</div>
</div>
<div class="nav-text">
Professors
</div>
</li>
<li>
<div class="nav-button">
<div class="Programs">
</div>
</div>
<div class="nav-text">
Programs
</div>
</li>
<li>
<div class="nav-button">
<div class="account">
</div>
</div>
<div class="nav-text">
My Account
</div>
</li>
</ul>
</div>
而CSS是:
#header-right{
float: right;
width: 366px;
height: 64px;
background-image:url('http://localhost/gradebyme/gradebyme/public/img/midtile2.png');
background-repeat:repeat-x;
}
#navigation{
/* position: relative;
background: url('http://localhost/gradebyme/gradebyme/public/img/icontest.png');*/
margin: 0;
padding: 0;
list-style: none;
}
#navigation li{
width: 88px;
height: 64px;
display: inline;
}
.nav-button{
width: 88px;
height: 40px;
}
.nav-text{
width: 88px;
height: 24px;
color:blue;
}
#schools{
float: left;
width: 37px;
height: 26.75px;
/* background-position: 0 0;*/
}
#professors{
float: left;
width: 37px;
height: 26.75px;
/* background-position: 0 -27px;*/
}
#programs{
float: left;
width: 37px;
height: 26.75px;
background-color: green;
/* background-position: 0 -55px;*/
}
#account{
float: left;
width: 37px;
height: 26.75px;
background-color: purple;
/* background-position: 0 -83px;*/
}
我需要它来水平显示它们,然后我可以添加图标。任何帮助表示赞赏!还赞赏一般的 css 技巧,我对它很陌生。