<ul class="nav">
<li><a href="#"><i class="icon-home"></i></a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Elements</a></li>
<li><a href="#">Contact us</a></li>
</ul>
.nav {
line-height: 70px;
margin: 0;
padding: 0;
border: 0;
}
.nav li {
list-style-image: none;
list-style-type: none;
margin-left: 0;
white-space: nowrap;
display: inline;
float: left;
padding-left: 4px;
padding-right: 4px;
}
.active {
background: pink;
}
.icon-home {
background: url(http://i.stack.imgur.com/MNme0.png) no-repeat;
width: 16px;
height: 14px;
display:block;
}
body {
background: gray;
}
如何使背景.active
占据li
图标的整个高度并居中?如果您查看演示,它不尊重li
.