`

css+div页面布局之2-- 固定宽度

    博客分类:
  • css
 
阅读更多
<div id="container"> 
  <div id="header"><h1>header</h1></div>
  <div id="wrapper"><!-- 主体文字 -->  
    <div id="content"><p><strong>1) Content here.</strong></p></div>  
  </div>  
  <div id="navigation"><p><strong>2) right part here.</strong></p></div>  
  <div id="extra"><p><strong>3) left part here.</strong></p></div>      
  <div id="footer"><p>footer</p></div>  
</div>

1:2:1固定宽度布局:
body {text-align:center;display:block;}
div#container{width:700px;margin:0 auto;}
div#header{text-align:left;width:100%;}
div#footer{text-align:left;width:100%;clear:left;}
div#wrapper{float:left;width:100%}  
div#content{text-align:left;margin-left:150px;width:400px;background:lightgreen;}  
div#navigation{text-align:left;float:left;width:150px;margin-left:-700px;background:#B9CAFF}  
div#extra{text-align:left;float:left;width:150px;margin-left:-150px;background:#FF8539}



1:1:2固定宽度布局:
body {text-align:center;display:block;}
div#container{width:700px;margin:0 auto;}
div#header{text-align:left;width:100%;}
div#footer{text-align:left;width:100%;clear:left;}
div#wrapper{float:left;width:100%}  
div#content{text-align:left;margin-left:300px;width:400px;background:lightgreen;}  
div#navigation{text-align:left;float:left;width:150px;margin-left:-700px;background:#B9CAFF}
div#extra{text-align:left;float:left;width:150px;margin-left:-550px;background:#FF8539} 



2:1:1固定宽度布局:
body {text-align:center;display:block;}
div#container{width:700px;margin:0 auto;}
div#header{text-align:left;width:100%;}
div#footer{text-align:left;width:100%;clear:left;}
div#wrapper{float:left;width:100%}  
div#content{text-align:left;margin-left:0px;width:400px;background:lightgreen;}  
div#navigation{text-align:left;float:left;width:150px;margin-left:-300px;background:#B9CAFF}  
div#extra{text-align:left;float:left;width:150px;margin-left:-150px;background:#FF8539}

  • 大小: 35.7 KB
  • 大小: 41.1 KB
  • 大小: 36.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics