我似乎无法让我的 UL 在其 DIV 中居中。
<div id="sitenavdiv">
<ul id="sitenav">
<li class="about"><a href="#" title=""><img src="images/about-link.png" alt="about"></a></li>
<li class="portfolio"><a href="#" title=""><img src="images/portfolio-link.png" alt="portfolio"></a></li>
<li class="contact"><a href="#" title=""><img src="images/contact-link.png" alt="contact"></a></li>
</ul>
</div>
我有以下CSS:
#sitenavdiv {padding-top: 30px; width: 620px; position: relative; float: left; text-align:center;}
ul#sitenav {width: 231; margin: 0 auto; display: inline;}
ul#sitenav li.about{width: 64px; height: 31px; display: block; float: left; overflow: hidden;}
ul#sitenav li.about a{width: 64px; height: 31px; display: block;}
ul#sitenav li.about a:hover{width: 64px; height: 31px; display: block; margin-top:-31px;}
ul#sitenav li.portfolio{width: 88px; height: 31px; display: block; float: left; overflow: hidden}
ul#sitenav li.portfolio a{width: 88px; height: 31px; display: block;}
ul#sitenav li.portfolio a:hover{width: 88px; height: 31px; display: block; margin-top:-31px;}
ul#sitenav li.contact{width: 79px; height: 31px; display: block; float: left; overflow: hidden}
ul#sitenav li.contact a{width: 79px; height: 31px; display: block;}
ul#sitenav li.contact a:hover{width: 79px; height: 31px; display: block; margin-top:-31px;}
我确定这很简单,但我似乎无法正确组合。