一入前端深似海——BFC剖析
BFC 实现原理,可以解决的问题,如何创建 BFC
BFC 的定义
BFC 的应用场景
<!--两栏布局-->
<style>
body {
width: 300px;
position: relative;
}
.aside {
width: 100px;
height: 150px;
float: left;
background: #f66;
}
.main {
height: 200px;
background: #fcc;
overflow: hidden;
}
</style>
<body>
<div class="aside"></div>
<div class="main"></div>
</body>
<style>
html,
body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
.left {
background: pink;
float: left;
width: 180px;
}
.center {
background: lightyellow;
overflow: hidden;
}
.right {
background: lightblue;
width: 180px;
float: right;
}
</style>
<div class="container">
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</div>创建 BFC
BFC 作用
最后更新于