BFC(block块,f格式化,c上下文content )译为"块级格式化上下文"javascript
它是指一个独立的块级渲染区域,只有Block-level BOX参与,该区域拥有一套渲染规则来约束块级盒子的布局,且与区域外部无关。css
CSS2.1中规定知足下列CSS声明之一的元素便会生成BFC。html
代码:java
<style>
body {
width: 300px;
position: relative;
}
.aside {
width: 100px;
height: 150px;
float: left;
background:
#f66;
}
.main {
height: 200px;
background:
#fcc;
}
</style>
<body>
<div
class
=
"aside"
></div>
<div
class
=
"main"
></div>
</body>
haslayout(是Windows Internet Explorer渲染引擎的一个内部组成部分)css3
- display: inline-block
- height: (除 auto 外任何值)
- width: (除 auto 外任何值)
- float: (left 或 right)
- position: absolute
- zoom: (除 normal 外任意值)
- writing-mode: tb-rl
附1:IE7特有的触发Layout的属性浏览器
- min-height: (任意值)
- min-width: (任意值)
- max-height: (除 none 外任意值)
- max-width: (除 none 外任意值)
- overflow: (除 visible 外任意值,仅用于块级元素)
- overflow-x: (除 visible 外任意值,仅用于块级元素)
- overflow-y: (除 visible 外任意值,仅用于块级元素)
- position: fixed
附2:默认触发Layout的HTML元素app
<html>, <body> <table>, <tr>, <th>, <td> <img> <hr> <input>, <button>, <select>, <textarea>, <fieldset>, <legend> <iframe>, <embed>, <object>, <applet> <marquee>