方法一: 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;
}
原文地址:https://www.cnblogs.com/wanDPS/p/10470334.html
时间: 2024-10-11 12:46:10