We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BFC
::: tip
:::
块级格式化上下文 页面中独立的渲染区域 决定内部 与外部无关 相互隔离 决定渲染区域里节点的排版、关系和相互作用的渲染规则
块级格式化上下文
页面中独立的渲染区域
决定内部
与外部无关
相互隔离
上下文 缩写 版本 声明 块格式化上下文 BFC 2 块级盒子容器 行内格式化上下文 IFC 2 行内盒子容器 弹性格式化上下文 FFC 3 弹性盒子容器 格栅格式化上下文 GFC 3 格栅盒子容器
BFC是页面上一个独立且隔离的渲染区域,容器里的子节点不会在布局上影响到外面的节点,反之亦然。
等等……
margin
我们先看一般的情况下,上下元素都有margin 的情况下,会出现重叠的情况,实际只有 50px,所谓的塌陷其实是两个BFC的相邻盒或父子盒相互作用时产生的效果,两个盒子会取相邻边最大margin作为相邻边的共用margin。
.box1 { margin-bottom: 50px; } .box2 { margin-top: 50px; }
.parent { width: 100px; /* 当父元素不写高度的时候会发生高度塌陷 */ /* height: 100px; */ border: 1px solid #ccc; } .float { float: left; width: 50px; height: 50px; background-color: #eee; }
overflow: auto; /* 或者 */ display: flow-root;
或者开发中常用的清除浮动的方式 https://fett.netlify.app/guides/css/css_mixin.html
The text was updated successfully, but these errors were encountered:
No branches or pull requests
title: 你知道什么是
BFC
吗 BFC 的布局规则是什么?如何创建 BFC?::: tip
BFC
吗:::
对块级上下文的理解
块级格式化上下文
页面中独立的渲染区域
决定内部
与外部无关
相互隔离
决定渲染区域里节点的排版、关系和相互作用的渲染规则
BFC的布局规则
触发条件是什么
等等……
作用与场景
margin
发生重叠(相邻元素的外边距重叠问题)我们先看一般的情况下,上下元素都有
margin
的情况下,会出现重叠的情况,实际只有 50px,所谓的塌陷其实是两个BFC的相邻盒或父子盒相互作用时产生的效果,两个盒子会取相邻边最大margin作为相邻边的共用margin。或者开发中常用的清除浮动的方式
https://fett.netlify.app/guides/css/css_mixin.html
The text was updated successfully, but these errors were encountered: