摘要:<!DOCTYPE html><html><head> <meta charset="utf-8"><title>三列布局左右絕對(duì)定位中間自適應(yīng)</title><style type="text/css"> body { &
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>三列布局左右絕對(duì)定位中間自適應(yīng)</title>
<style type="text/css">
body { /*初始樣式。用于相對(duì)定位relative*/
margin: 0;
padding: 0;
}
.container {
position: absolute; /*設(shè)置絕對(duì)定位時(shí)必須要設(shè)置左右兩邊頂點(diǎn)*/
left: 0;
right: 0;
}
.left {
position: absolute; /*絕對(duì)定位*/
top: 0;
left: 0;
width: 200px;
height: 600px;
background-color: red;
}
.right {
position: absolute; /*絕對(duì)定位*/
top: 0;
right: 0;
width: 200px;
height: 600px;
background-color: yellow;
}
.main {
height: 600px;
margin-left: 200px;
margin-right: 200px;
background-color: blue;
}
</style>
</head>
<body>
<h2></h2>
<p>1.左右兩列采用約定定位布局<br>
2.中間內(nèi)容不更采用margin擠壓出來
</p>
<div class="container">
<div class="left">左側(cè)</div>
<div class="right">右側(cè)</div>
<div class="main">主體</div>
</div>
</body>
</html>
批改老師:查無此人批改時(shí)間:2019-04-26 13:24:50
老師總結(jié):完成的不錯(cuò),剛接觸編程,比較辛苦。要堅(jiān)持,繼續(xù)加油。