慕粉1024203737
2017-01-18 14:16
跟老师的代码一样,为什么不能居中。。在ie不行 在360可以
<body>
<div class="top">
<div class="top_content">
<ul>
<li>设为首页</li>
<li>加入收藏</li>
<li>联系我们</li>
</ul>
</div>
</div><!--top结束-->
</body>
*{ margin:0;
padding:0;
font-size:12px;}
body{ background-color:#F5f5f5;}
.top{ width:100%;
height:27px;
background:url(../images/top_bg.jpg) repeat-x;
}
.top_content{
width:1000px;
margin:0 auto;
}
你定义的class名为top_content的div已经居中了。你又没有定义ul居中,所以ul自然会在宽度为1000px,的div左侧边上了。你接下来对li进行浮动,然后定义宽度就可以了
企业网站综合布局实战
157042 学习 · 1984 问题
相似问题