You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<divclass="eg eg-1"><divclass="aside"></div><divclass="main">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
</div></div>
BFC 知识整理
BFC 概念
BFC (块级格式化上下文)
BFC 如何创建
BFC 的原理(渲染规则)
BFC 的应用
CodePan查看效果
如果一个浮动元素后面跟着一个非浮动的元素,那么就会产生一个覆盖的现象,这时候在非浮动元素上添加文字,文字会环绕浮动元素。防止文字环绕也就是利用BFC 使非浮动元素与浮动元素不重叠。
当触发main生成BFC后,这个新的BFC不会与浮动的aside重叠,文字环绕的效果也消失了。main会根据包含块的宽度,和aside的宽度,自动变窄。
CodePan查看效果
触发par生成BFC,那么par在计算高度时,par内部的浮动元素child也会参与计算。
CodePan查看效果
同属于一个BFC时,两个元素发生垂直margin重叠,包括相邻元素,嵌套元素,只要他们之间没有阻挡,因此使用一个wrap 包裹住第二个p 元素并生成BFC ,此时两个P 元素不属于同一个BFC ,消除margin 重叠。
The text was updated successfully, but these errors were encountered: