如何列出给出display:block并向左浮动的标签,在无序列表中居中。
HTML:
<div id="navigation">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Contact</li>
<li>News</li>
<li>Events</li>
<li>Video</li>
<li>Photos</li>
</ul>
</div><!-- navigation -->
CSS:
#navigation {
border: 3px solid orange;
overflow: hidden;
}
#navigation ul {
list-style-type: none;
text-align: center;
}
#navigation ul li {
float: left;
display: block;
padding: 10px 8px;
border: 1px solid green;
}
答案 0 :(得分:0)
而不是display:block,请使用:
#navigation ul li {
display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:inline;
padding: 10px 8px;
border: 1px solid green;
}