css圣杯布局、等高布局

所谓圣杯布局,就是自适应浏览器的分辨率,也称双飞翼布局。

例子:

 1 <style>
 2 body{margin:0;}
 3 .center{height:600px;background:#f60;margin:0 200px;}
 4 .left{width:200px;background:#fc0;height:600px; position:absolute;left:0;top:0;}
 5 .right{width:200px;background:#fcc;height:600px;position:absolute;right:0;top:0;}
 6 </style>
 7 </head>
 8 <body>
 9 <div class="center">2</div>
10 <div class="left">1</div>
11 <div class="right">3</div>

等高布局:

例子:

 1 style>
 2 body{margin:0;}
 3 .wrap{ 900px;margin:0 auto; border:10px solid #000; overflow:hidden;}
 4 .wrap:after{content:"";display:block;clear:both;}
 5 .left{200px;background:Red;float:left; padding-bottom:1000px; margin-bottom:-1000px;}
 6 .right{200px;background:blue;float:right;padding-bottom:1000px;margin-bottom:-1000px;}
 7 </style>
 8 </head>
 9 <body>
10 <div class="wrap">
11     <div class="left">
12         &nbsp;页面内容<br/>
13         &nbsp;页面内容<br/>
14         &nbsp;页面内容<br/>
15         &nbsp;页面内容<br/>
16         &nbsp;页面内容<br/>
17     </div>
18     <div class="right">
19     </div>
20 </div>
原文地址:https://www.cnblogs.com/wxydigua/p/3459744.html