サマリー:<!DOCTYPE html><html><head> <meta charset="utf-8"><title>三列布局左右絕對定位中間自適應</title><style type="text/css"> body { &
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>三列布局左右絕對定位中間自適應</title>
<style type="text/css">
body { /*初始樣式。用于相對定位relative*/
margin: 0;
padding: 0;
}
.container {
position: absolute; /*設(shè)置絕對定位時必須要設(shè)置左右兩邊頂點*/
left: 0;
right: 0;
}
.left {
position: absolute; /*絕對定位*/
top: 0;
left: 0;
width: 200px;
height: 600px;
background-color: red;
}
.right {
position: absolute; /*絕對定位*/
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>
添削の先生:查無此人添削時間:2019-04-26 13:24:50
先生のまとめ:完成的不錯,剛接觸編程,比較辛苦。要堅持,繼續(xù)加油。