批改状态:未批改
老师批语:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>4.经典的三列圣杯布局</title>
<style type="text/css">
.header, .footer {
width: 100%;
height: 60px;
background-color: lightskyblue;
}
.footer {
clear: both;
}
.content {
width: 1000px;
margin: auto;
line-height: 60px;
height: 100%;
background-color: gray;
text-align: center;
}
.container {
width: 600px;
margin:auto;
background-color: yellow;
overflow: hidden;
padding:0 200px;
}
.container .main {
/*先设置行高暂时填充*/
min-height: 650px;
/*设置100%的宽度,避免被挤*/
width: 100%;
float:left;
background-color: lightgreen;
}
.container .left {
width: 200px;
/*最小高度,设置为行高一致*/
min-height: 650px;
float:left;
margin-left: -100%;
/*设置相对定位*/
position: relative;
right: 200px;
background-color: red;
}
.container .right {
width: 200px;
min-height: 650px;
float:left;
margin-left:-200px;
position: relative;
right:-200px;
background-color: blue;
}
</style>
</head>
<body>
<!-- Html的DOM结构 -->
<!-- 头部 -->
<div class="header">
<div class="content">网站头部</div>
</div>
<!-- 内容区 -->
<div class="container">
<div class="main">主体</div>
<div class="left">左侧</div>
<div class="right">右侧</div>
</div>
<!-- 底部 -->
<div class="footer">
<div class="content">网站底部</div>
</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号