.container{
display: flex;
}
.l{
width: 100px;
}
.r{
flex: 1;
}.l{
width: 100px;
float: left;
}
.r{
margin-left: 100px;
}.l{
width: 100px;
float: left;
}
.r{
overflow: hidden;
}通过设置overflow创建了一个BFC,可以形成一个独立的容器,浮动盒区域不叠加在BFC上,容器内子元素不会影响到外面的元素,反之亦然。设置overflow:auto;等都能达到同样效果,只需要形成一个BFC。
.container{
display: table;
table-layout: fixed;
width: 100%;
}
.l{
width: 100px;
}
.r, .l{
display: table-cell;
}.container{
display: flex;
}
.l{
flex: 1;
}
.r{
width: 100px;
}.l{
float: left;
margin-right: -100px;
width: 100%;
}
.r{
float: right;
width: 100px;
}.container{
display: table;
table-layout: fixed;
width: 100%;
}
.r{
width: 100px;
}
.l, .r{
display: table-cell;
}.container{
display: flex;
}
.l{
width: 100px;
}
.c{
flex: 1;
}
.r{
width: 100px;
} .container{
}
.l{
float: left;
width: 100px;
}
.c{
float: left;
margin-right: -200px;
width: 100%;
}
.r{
float: left;
width: 100px;
}.container{
display: table;
table-layout: fixed;
width: 100%;
}
.l{
width: 100px;
}
.r{
width: 100px;
}
.l, .r, .c{
display: table-cell;
}.container{
display: flex;
}
.r{
flex: 1;
}.container{
display: table;
}
.l{
background-color: red;
width: 1%;
}
.r{
background-color: gainsboro;
}
.l, .r{
display: table-cell;
}左侧元素浮动,右侧元素通过overflow形成BFC。
.l{
float: left;
background-color: blanchedalmond;
}
.r{
overflow: hidden;
background-color: red;
}.container{
display: flex;
}
.ele{
flex: 1;
}.ele{
float: left;
width: 25%;
}.container{
display: table;
width: 100%;
table-layout: fixed;
}
.ele{
display: table-cell;
}