<div class="main">
<div class="left">200px</div>
<div class="middle">自适应</div>
<div class="right">300px</div>
</div>body {
margin: 0;
padding: 0;
}
.main {
width: 900px;
margin: 0 auto;
height: 600px;
position:relative;
}
.left {
width: 200px;
background: rebeccapurple;
height: 600px;
position: absolute;
top: 0;
left: 0;
}
.right {
width: 300px;
background: beige;
height: 600px;
position: absolute;
top: 0;
right: 0;
}
.middle {
height: 600px;
margin: 0 210px 0 310px;
position: relative;
}我想在main里面进行三列布局,请问应该怎么布局呢
1 回答
西兰花伟大炮
TA贡献376条经验 获得超318个赞
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> html,body{margin: 0;height: 100%;} /*不加html会出现中间内容区域高度塌陷*/ .left, .right{ position: absolute; top: 0; height: 100%; width: 200px; } .left{left: 0;background-color: #FF8C00;} .right{right: 0;background-color: lightpink;} .main{margin: 0 210px;background-color: #1E90FF;height:100%;} </style> </head> <body> <div class="left">我是左边部分</div> <div class="right">我是右边部分</div> <div class="main">我是内容部分</div> </body> </html>
- 1 回答
- 0 关注
- 1126 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消