Maison >interface Web >tutoriel HTML >新手div的嵌套不会排列整齐_html/css_WEB-ITnose
]#headertop{width:800px;height:20px;background:#CCFF77;}#headertop ul{list-style:none;}#headertop ul li{float:left;margin:10px auto 10px 0}#headerbottom{width:800px;height:80px;background:#CCFF44}#headerbottomleft{width:100px;height:80px;text-align:left;background:#CCFF55}#headerbottomcenter{width:400px;height:70px;background:#CCFF33}#headerbottomright{width:300px;height:70px;background:#CCFF66}<div id="header"> <!--页面头部--> <div id="headertop"> <ul> <li>亲,欢迎来淘宝!请</li> </ul> </div> <div id="headerbottom"> <div id="headerbottomleft"></div> <div id="headerbottomcenter"> </div> <div id="headerbottomright"></div> </div> </div>
<html><head> <style type="text/css">#header{width:798px;height:198px;border:1px solid blue; }#headertop{width:798px;height:48px;background:#CCFF77;border-bottom: dashed 1px;}#headertop ul{list-style:none;display: inline;}#headertop ul li{float: left;line-height: 48px;margin-left:40px; }#headerbottom{width:798;height: 148px;background: #CBFF43;}#headerbottomleft{width: 100;height: 80px;margin: 0 auto;border-left: dashed 1px;border-right: dashed 1px;}#headerbottomcenter{width: 384px;height:68px;margin:0 auto;border-top:dashed 1px;border-left: dashed 1px;border-right: dashed 1px;} </style><body> <div id="header"> <!--页面头部--> <div id="headertop"> <ul> <li>亲,欢迎来淘宝!请</li> </ul> </div> <div id="headerbottom"> <div id="headerbottomleft"></div> <div id="headerbottomcenter"> </div> <div id="headerbottomright"></div> </div> </div></body>
#headerbottom{width:800px;height:80px;background:#CCFF44;clear:both;}
#headerbottomleft{width:100px;height:80px;text-align:left;background:#CCFF55; float:left;}
#headerbottomcenter{width:400px;height:70px;background:#CCFF33; float:left;}
#headerbottomright{width:300px;height:70px;background:#CCFF66; float:right;}