当前位置:网站首页>BFC(Block Formatting Context)
BFC(Block Formatting Context)
2022-08-05 05:13:00 【Ly666_ever】
常见定位方案
一、普通流 (normal flow)
在普通流中,元素按照其在 HTML 中的先后位置至上而下布局,在这个过程中, 行内元素水平排列,直到当行被占满然后换行,块级元素则会被渲染为完整的一个新行, 除非另外指定,否则所有元素默认都是普通流定位,也可以说,普通流中元素的位置由该元素在 HTML 文档中的位置决定。
二 浮动 (float)
在浮动布局中,元素首先按照普通流的位置出现,然后根据浮动的方向尽可能的向左边或右边偏移
三 绝对定位 (absolute)
在绝对定位布局中,元素会整体脱离普通流, 因此绝对定位元素不会对其兄弟元素造成影响,而元素具体的位置由绝对定位的坐标决定
BFC 概念
BFC 即 Block Formatting Contexts (块级格式化上下文),它属于上述定位方案的普通流。 具有 BFC 特性的元素可以看作是隔离了的独立容器,容器里面的元素不会在布局上影响到外面的元素,它是一个独立的渲染区域,只有block-levelbox参与,规定了内部block-level-box如何布局,并且 BFC 具有普通容器所没有的一些特性。 你可以把 BFC 理解为一个封闭的大箱子,箱子内部的元素不会影响到外部。
触发BFC
1.body 根元素
2.浮动元素:float 除 none 以外的值
3.绝对定位元素:position (absolute、fixed)
4.display 为 inline-block、table-cells、flex
5.overflow 除了 visible 以外的值 (hidden、auto、scroll)
解决问题
1.边距重叠
2.清除浮动
3.两列布局,左列定宽,右列自适应
边栏推荐
- Convert the paper official seal in the form of a photo into an electronic official seal (no need to download ps)
- redis事务
- Error creating bean with name 'configDataContextRefresher' defined in class path resource
- How does the Flutter TapGestureRecognizer work
- OFDM Lecture 16 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems
- The mall background management system based on Web design and implementation
- Understanding and use of C# on set() and get() methods
- Using QR codes to solve fixed asset management challenges
- human weakness
- ES6 生成器
猜你喜欢

【过一下7】全连接神经网络视频第一节的笔记

【过一下 17】pytorch 改写 keras

多线程查询结果,添加List集合

逆向理论知识4

Using QR codes to solve fixed asset management challenges

【过一下3】卷积&图像噪音&边缘&纹理

Detailed Explanation of Redis Sentinel Mode Configuration File

【练一下1】糖尿病遗传风险检测挑战赛 【讯飞开放平台】
![[cesium] 3D Tileset model is loaded and associated with the model tree](/img/03/50b7394f33118c9ca1fbf31b737b1a.png)
[cesium] 3D Tileset model is loaded and associated with the model tree

Flex layout frog game clearance strategy
随机推荐
Returned object not currently part of this pool
Convert the paper official seal in the form of a photo into an electronic official seal (no need to download ps)
redis事务
学习总结week3_1函数
Flutter learning 2-dart learning
DOM及其应用
多线程查询结果,添加List集合
Returned object not currently part of this pool
2022杭电多校第一场01
ESP32 485 Illuminance
Lecture 4 Backpropagation Essays
server disk array
HQL语句执行过程
物理层的接口有哪几个方面的特性?各包含些什么内容?
"Recursion" recursion concept and typical examples
OFDM 十六讲 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems
The role of the range function
Flutter learning three-Flutter basic structure and principle
1.3 mysql批量插入数据
The role of DataContext in WPF