圣杯布局
作者:互联网
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>圣杯布局</title> <style type="text/css"> * { margin: 0; padding: 0; } body { min-width: 700px; } .header, .footer { float: left; width: 100%; background-color: #DDDDDD; height: 40px; line-height: 40px; text-align: center; } .container { padding: 0 220px 0 200px; } .left, .middle, .right { position: relative; float: left; min-height: 333px; } .middle { width: 100%; background-color: blueviolet; } .left { width: 200px; background-color: red; left: 0; margin-left: -100%; left: -200px; } .right { width: 220px; background-color: gold; margin-right: -220px; /*margin-left: -220px; right: -220px;*/ /*margin-left: -220px ; left: 220px;*/ } </style> </head> <body> <div class="header"> 头 </div> <div class="container"> <div class="middle">中</div> <div class="left">左</div> <div class="right">右</div> </div> <div class="footer"> 尾 </div> </body> </html>
布局要求:
1、三列布局,中间宽度自适应,两边定宽
2、中间栏要在浏览器中优先展示渲染
3、允许任意列的高度最高
4、用最简单的css、最少的HACK语句
标签:right,圣杯,width,color,布局,220px,margin,left 来源: https://www.cnblogs.com/Harold-Hua/p/13038556.html