的HTML
<nav class="cf">
<div class="logo">
<a href="#">Logo</a>
</div>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</nav>
CSS
.cf:before, .cf:after { content: " "; display: table; }
.cf:after { clear: both; }
ul {
margin: 0;
padding: 0;
list-style: none;
background: red;
}
nav {
background: grey;
text-align: center;
}
nav ul {
font-size: 0px;
text-align: right;
}
nav li {
font-size: 14px;
display: inline;
}
nav li a {
display: inline-block;
width: auto;
background: green;
}
.logo {
font-size: 33px;
background: orange;
float: left;
}
小提琴
http://jsfiddle.net/M9Sdd/
问题
如何ul
在(灰色背景)内垂直居中(红色背景nav
)?