Correction status:Uncorrected
Teacher's comments:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>3.经典的三列圣杯布局</title> <style type="text/css"> .header, .footer { width: 100%;/*宽度自适应*/ height: 60px; background-color: lightblue; } .footer { float: both; } .content { width: 1000px; min-height: 100%; background-color: lightskyblue; margin:auto; text-align: center; line-height: 60px;/*垂直居中*/ overflow: hidden; } .contenter { width: 600px; margin:auto; background-color: yellow; padding:0 200px; overflow: hidden; } .contenter .main { width: 100%; min-height: 650px; float: left; background-color: lightyellow; } .contenter .left { width: 200px; min-height: 650px; float: left; margin-left: -100%; position: relative; left: -200px; background-color: pink; } .contenter .right { width: 200px; min-height: 650px; float: left; margin-left: -200px; position: relative; right: -200px; background-color: lightgreen; } </style> </head> <body> <!-- DOM结构 --> <!-- 头部 --> <div class="header"> <div class="content">网站头部</div> </div> <!-- 内容区 --> <div class="contenter"> <div class="main">中间</div> <div class="left">左侧</div> <div class="right">右侧</div> </div> <!-- 底部 --> <div class="footer"> <div class="content">网站底部</div> </div> </body> </html>
点击 "运行实例" 按钮查看在线实例