CSS左侧固定右侧自适应

方法一: float + margin
.left{
float: left;
width: 100px;
}
.right {
margin-left:100px;
}
/*清除浮动*/
.container1:after{
content: "";
height: 0;
line-height: 0;
display: block;
visibility: hidden;
clear: both;
}

方法二: 父容器设置 display:flex;Right部分设置 flex:1 

body{

 display:flex;

}

.right{

flex-grow: 1;

}

猜你喜欢

转载自www.cnblogs.com/wanDPS/p/10470334.html