当前位置:网站首页>Element's BFC attribute
Element's BFC attribute
2022-08-11 03:26:00 【Y-Joan Eye】
BFC is the abbreviation of Block Formatting Context
When an element has the BFC attribute enabled, the element will become an independent area, it will not affect other elements, so the layout will not be cluttered.
Characteristics when elements enable BFC
1. The vertical margin of the parent element will not overlap with the child element (to solve the problem of overlapping parent and child margins)
We talked about the problem of overlapping parent and child margins earlier. At that time, we said that the BFC attribute can be turned on
2. Elements with BFC enabled will not be covered by floating elements
3. Elements with BFC enabled can contain floating child elements (which can solve height collapse)
The previous article explained the problem of height collapse in detail, you can go and see it.
How to turn on BFC
1. Set the element to float (not recommended)
Although the parent element can be stretched, it will cause the width of the parent element to be lost, and this method will cause the element below to move up, affecting the page layout
2. Set the display property to inline-block (not recommended)
Can solve the problem of height loss, but will result in loss of width, and there will be three pixels of white space
3. Set the element's overflow attribute to a non-visible value (recommended)
Generally use the hidden attribute value, there will be a three-pixel blank problem
The side effects are relatively small, it is recommended to use
4. Set element absolute positioning (not recommended)
边栏推荐
猜你喜欢

When EasyCVR is connected to the GB28181 device, what is the reason that the device is connected normally but the video cannot be played?

多串口RS485工业网关BL110

CSDN 博客更换皮肤

【愚公系列】2022年08月 Go教学课程 036-类型断言

基于改进YOLOv5轻量化的烟火检测

分布式和集群的区别和联系

Getting Started with Raspberry Pi (5) System Backup

Salesforce解散中国团队,什么样的CRM产品更适合中国人

云平台下ESB产品开发步骤说明

JS-DOM element object
随机推荐
程序化交易与主观交易对盈利曲线的影响!
MYSQLg高级------回表
How can users overcome emotional issues in programmatic trading?
The problem that Merge will be lost again after code Revert has been solved
C语言之自定义类型------结构体
Idea (preferred) cherry-pick operation
pathman_config、pathman_config_params 删除后,如何重建?
[DB operation management/development solution] Shanghai Daoning provides you with an integrated development tool to improve the convenience of work - Orange
音视频开发,为什么要学习FFmpeg?应该怎么入手FFmpeg学习?
EasyCVR接入海康大华设备选择其它集群服务器时,通道ServerID错误该如何解决?
this question in js
字体反扒
21天学习挑战赛第一周总结
watch监听
What has programmatic trading changed?
Google search skills - programmer is recommended
(Nips-2015) Spatial Transformer Network
高度塌陷问题的解决办法
JS-DOM element object
【LeetCode】Day112-重复的DNA序列