常用的后台布局方式。左侧固定,右侧宽度自适应屏幕。
<div class="float-box">
<div class="aside"></div>
<div class="main"></div>
</div>
.float-box {
position: relative;
}
.aside {
width: 100px;
height: 150px;
float: left;
background: #f66;
}
.main {
height: 200px;
background: #fcc;
overflow: hidden;
}
.float-box {
position: relative;
}
.aside {
width: 100px;
height: 150px;
float: left;
background: #f66;
}
.main {
height: 200px;
background: #fcc;
position: absolute;
left: 100px;
right: 0;
}
.float-box {
position: relative;
}
.aside {
width: 100px;
height: 150px;
float: left;
background: #f66;
}
.main {
height: 200px;
margin-left: 100px;
background: #fcc;
}
.float-box {
display: flex;
justify-content: flex-start;
}
.aside {
width: 100px;
height: 150px;
background: #f66;
flex-shrink: 0;
}
.main {
height: 200px;
background: #fcc;
flex-grow: 1;
flex-shrink: 0;
flex-basis: auto;
}
.float-box {
position: relative;
}
.aside {
width: 100px;
height: 150px;
float: left;
background: #f66;
}
.main {
float: left;
height: 200px;
background: #fcc;
width: calc(100% - 100px)
}
原文:https://www.cnblogs.com/shenggao/p/12381328.html