<html>
<style type="text/css">
.myUl
{clear:both; position:relative; left:50%; float:left; margin-bottom:2px;}
.myUl li
{ float:left; position:relative; left:-50%; margin-right:2px;}
</style>
</head>
<body>
<div style="text-align:center;">
<span>给父元素设置text-align:center可以实现 文本、图片等行内元素的水平居中</span>
</div>
<div style="width:100%;">
<ul class="
myUl
">
<
li
><a href="#"><span>A</span></a></li>
</ul>
<ul class="myUl">
<li><a href="#"><span>A</span></a></li>
<li><a href="#"><span>B</span></a></li>
</ul>
</div>
</body>
</html>