html怎么这个ul不能居中呢??

哪里不对了
<html>
<head>
<style>
*{margin:0;padding:0;}
#a{height:300px;width:1024px;border:1px solid;margin:0 auto;}
#a ul{margin:0 auto;}
#a ul li{solid:white;display:block;list-style-type:none;float:left;height:30px;width:100px;text-align:center;line-height:30px;}
#a ul li:hover{background:blue;}
</style>
</head>
<body>
<div id="a">
<ul>
<li><a>北京</a></li>
<li><a>河北<a></li>
<li><a>天津<a></li>
<li><a>南京<a></li>
</ul>
</div>
</body>
</html>

第1个回答  2014-12-25

#a ul{margin:0 auto;} 加个width宽度就可以的。你没定义具体宽度。

#a ul{margin:0 auto;WIDTH:400px;}

本回答被提问者采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网