我有一个包含内联块 li 的导航。每个 li 包含两个块跨度元素,因此它会在翻转时进行动画处理。我的问题是 li 导航的中心对齐和间距。我不想给 li 标签一个最小宽度。有人能帮忙吗?
HTML:
<div id="nav">
<ul>
<li class="button">
<a href="#">
<span class="top">Home</span>
<span class="bottom">Home</span>
</a>
</li>
<li class="button">
<a href="#">
<span class="top">About</span>
<span class="bottom">About</span>
</a>
</li>
<li class="button">
<a href="#">
<span class="top">Equine</span>
<span class="bottom">Equine</span>
</a>
</li>
<li class="button">
<a href="#">
<span class="top">Canine</span>
<span class="bottom">Canine</span>
</a>
</li>
<li class="button">
<a href="#">
<span class="top">Rates & Travel</span>
<span class="bottom">Rates & Travel</span>
</a>
</li>
<li class="button">
<a href="#">
<span class="top">Case Study & News</span>
<span class="bottom">Case Study & News</span>
</a>
</li>
</div> <!---nav---->
CSS:
#nav {
height: 25px;
border-top: 2px solid #FFFFFF;
border-bottom: 1px solid #C7C7C7;
padding: 10px 0px 5px 0px;
text-align: center;
}
#nav li{
height: 16px;
line-height: 15px;
overflow: hidden;
display: inline-block;
padding: 0px 25px 0px 25px;
position: relative;
}
li span.top {
color: #16528e;
top: -18px;
}
a:hover span {
top: 18px;
}
a:hover span.top {
top: 0;
}
li span {
display: block;
top: 0;
position: absolute;
-webkit-transition: top 0.3s, border 0.3s, color 0.35s;
-moz-transition: top 0.3s, border 0.3s, color 0.35s;
-ms-transition: top 0.3s, border 0.3s, color 0.35s;
-o-transition: top 0.3s, border 0.3s, color 0.35s;
transition: top 0.3s, border 0.3s, color 0.35s;
}