標(biāo)題不能居中
跟老師的代碼一樣,為什么不能居中。。在ie不行 在360可以
<body>
<div class="top">
?<div class="top_content">
? <ul>
? ?<li>設(shè)為首頁(yè)</li>
? ?<li>加入收藏</li>
? ?<li>聯(lián)系我們</li>
? </ul>
? </div>
</div><!--top結(jié)束-->
</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;
}
2017-01-18
你定義的class名為top_content的div已經(jīng)居中了。你又沒(méi)有定義ul居中,所以u(píng)l自然會(huì)在寬度為1000px,的div左側(cè)邊上了。你接下來(lái)對(duì)li進(jìn)行浮動(dòng),然后定義寬度就可以了