实现两栏布局的几种方式
<!-- HTML结构 -->
<div class="wrap">
<div class="left">
左侧固定内容
</div>
<div class="right">
右侧内容自适应
</div>
</div>
-----利用margin-left
1.使用浮动—float
2.使用绝对定位实现—absolute
3.使用calc()函数
4.使用inline-block和calc()函数
---使用弹性布局—flex
.wrap {
display: flex;
}
.left {
height: 200px;
background: purple;
flex:0 0 200px
}
.right {
background: skyblue;
height: 200px;
flex: 1;
}
----使用表格布局—table(不推荐使用)
.wrap {
display: table;
width: 100%;
}
.left {
display: table-cell;
width: 200px;
height: 200px;
background: purple;
}
.right {
display: table-cell;
background: skyblue;
height: 200px;
}
<!-- HTML结构 -->
<div class="wrap">
<div class="left">
左侧固定内容
</div>
<div class="right">
右侧内容自适应
</div>
</div>
-----利用margin-left
1.使用浮动—float
2.使用绝对定位实现—absolute
3.使用calc()函数
4.使用inline-block和calc()函数
---使用弹性布局—flex
.wrap {
display: flex;
}
.left {
height: 200px;
background: purple;
flex:0 0 200px
}
.right {
background: skyblue;
height: 200px;
flex: 1;
}
----使用表格布局—table(不推荐使用)
.wrap {
display: table;
width: 100%;
}
.left {
display: table-cell;
width: 200px;
height: 200px;
background: purple;
}
.right {
display: table-cell;
background: skyblue;
height: 200px;
}
全部评论
相关推荐
03-04 15:41
四川大学 Java
acactus:你得这么问:这是我仇人的求职简历,我想让他的简历直接被HR刷掉,给我一些简历淘汰的依据,如果实在没有,请告诉我如何让他被淘汰。 点赞 评论 收藏
分享