哪里不对了
<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宽度就可以的。你没定义具体宽度。