abstract:<style>.header{width: 100%;background-color: lightgray;}.header .content{width: 1000px;height: 60px;background-color: lightgreen;margin: 0 auto;}.header .content .nav{margin: 0;padding: 0;}.head
<style>
.header{
width: 100%;
background-color: lightgray;
}
.header .content{
width: 1000px;
height: 60px;
background-color: lightgreen;
margin: 0 auto;
}
.header .content .nav{
margin: 0;
padding: 0;
}
.header .content .nav .item{
list-style: none;
}
.header .content .nav .item a{
float: left;
padding:0 20px;
min-width: 10px;
min-height: 10px;
line-height: 60px;
text-decoration: none;
text-align: center;
}
.header .content .nav .item a:hover{
background-color: #444444;
color: azure;
}
/* 第一步:主體容器設(shè)置總寬度,并水平居中 */
.container{
width: 1000px;
min-height: 600px;
background-color: lightcyan;
margin:5px auto;
}
/* 第二步:左,右兩側(cè)固定寬度,中間區(qū)塊自適應(yīng) */
/* 中間區(qū)塊寬度設(shè)置在它的容器wrap中 */
.wrap{
width: inherit;
/* inherit關(guān)鍵字代表“使用指定給父元素的所有值” */
min-height: inherit;
background-color: cyan;
}
/* 設(shè)置左右區(qū)塊的寬度和高度(因?yàn)闊o內(nèi)容所以設(shè)置最小高度),并設(shè)置參考色塊 */
.left{
width: 200px;
min-height: 600px;
background-color: lightcoral;
}
.right{
width: 200px;
min-height: 600px;
background-color: lightgreen;
}
/* 第三步:中間,左右區(qū)塊全左浮動(dòng) */
.wrap,.right,.left{
float: left;
}
/* 第四步:將left和right拉回到他們正確的位置上 */
/* 通過設(shè)置區(qū)塊的負(fù)邊距的方式,實(shí)現(xiàn)向反方向移動(dòng)區(qū)塊 */
.left{
margin-left: -100%;
}
.right{
margin-left: -200px;
}
/* 第五步:將主體區(qū)塊main顯示出來 */
.main{
padding-left: 200px;
padding-right: 200px;
}
.footer{
width: 100%;
background-color: lightgray;
}
.footer .content{
width: 1000px;
height: 60px;
text-align: center;
margin:5px auto;
line-height: 60px;
}
.footer .content p a{
text-decoration: none;
}
.footer .content p a:hover{
color: aqua;
}
</style>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="main.js"></script>
</head>
<body>
<!-- 頭 -->
<div class="header">
<div class="content">
<ul class="nav">
<li class="item"><a href="">首頁</a></li>
<li class="item"><a href="">公司新聞</a></li>
<li class="item"><a href="">最新產(chǎn)品</a></li>
<li class="item"><a href="">聯(lián)系我們</a></li>
</ul>
</div>
</div>
<!--【雙飛翼】中間主體的區(qū)塊模擬 -->
<div class="container">
<!-- 創(chuàng)建雙飛翼布局使用的DOM結(jié)構(gòu) -->
<div class="wrap"><!-- 進(jìn)行包裹的父級(jí)容器 -->
<div class="main">
主體內(nèi)容區(qū)
</div>
</div>
<div class="left">左側(cè)</div>
<div class="right">右側(cè)</div>
</div>
<!-- 底型 -->
<div class="footer">
<div class="content">
<p>
<a href="">php中文網(wǎng)</a>
<a href="">89126620</a>
<a href="">安徽合肥</a>
</p>
</div>
</div>
</body>
</html>
Correcting teacher:韋小寶Correction time:2019-01-18 17:52:36
Teacher's summary:寫的很棒 !像前端布局這一塊 一定要多練習(xí)