方法一:
body{
margin: 0;
}
.container{
height: 300px;
overflow: hidden;
}
.left{
width: 200px;
height: 300px;
background: red;
position: absolute;
left:0;
top: 0;
}
.right{
margin-left:200px;
width: 100%;
height: 300px;
background: green;
}
<div class="container">
<div class="left"> </div>
<div class="right"> </div>
</div>
方法二:
body{
margin:0;
}
#wrapper{
height: 300px;
overflow: hidden;
}
.left{
width: 200px;
height: 100%;
background: red;
float: left;
}
.right{
width: 100%;
height: 100%;
float: right;
background: green;
margin-right: -200px;
}
<div id="wrapper">
<div class="left">
</div>
<div class="right">
</div>
</div>
两列布局,一列定宽,一列宽度自适应
时间: 2024-10-11 16:50:12