整个页面排版分为四个大块,宽度相等。
CSS样式如下:
<style type="text/css">
*{margin:0; padding:0}
div {border:solid 1px #666}
body {font:12px/2 simsu}
#header,#nav,#mainbody,#footer {width:380px; background:#cefece; margin:0 auto}
#header,#footer{clear:both; height:50px}
#nav {height:30px; margin:10px auto}
#mainbody {height:350px; margin-bottom:10px}
#main {width:200px; height:310px; margin:20px; background:#feff99; float:left}
#side {width:120px; height:310px; margin:20px 0; background:#ffcb99; float:left}
</style>
DIV布局如下:
<div id="header">header</div>
<div id="nav">nav</div>
<div id="mainbody">
<div id="main">main</div>
<div id="side">side</div>
</div>
<div id="footer">footer</div>
排好了,复制以上代码,请看下方效果图:
页面中的宽、高、或内外边距,自己根据情况更改,宽度可以设置也1002PX,
也可以设置为100%;如果不需要边框线,只需把:div {border:solid 1px #666} 这条代码删除即可。
纯手打,记得采纳哦!
写了一个小demo,仅供参考。
本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。