当前位置:网站首页>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)
边栏推荐
- 广州纸质发票再见!开住宿费电子发票即将全面取代酒店餐饮加油站发票
- leetcode: 358. Reorder strings at K distance intervals
- [Pdf generated automatically bookmarks]
- pathman_config、pathman_config_params 删除后,如何重建?
- Detailed explanation of VIT source code
- uni-app - 获取汉字拼音首字母(根据中文获取拼音首字母)
- 电商项目——商城限时秒杀功能系统
- What problems should we pay attention to when building a programmatic trading system?
- App基本框架搭建丨日志管理 - KLog
- 音频编解码,利用FAAC来实现AAC编码
猜你喜欢

A large horse carries 2 stone of grain, a middle horse carries 1 stone of grain, and two ponies carry one stone of grain. It takes 100 horses to carry 100 stone of grain. How to distribute it?

rac备库双节点查询到的表最后更新时间不一致

树莓派入门(5)系统备份

Multi-merchant mall system function disassembly 26 lectures - platform-side distribution settings

Unity2D animation (1) introduction to Unity scheme - animation system composition and the function of use

The problem that Merge will be lost again after code Revert has been solved

【Yugong Series】August 2022 Go Teaching Course 036-Type Assertion

多串口RS485工业网关BL110

Qnet Weak Network Test Tool Operation Guide

leetcode:358. K 距离间隔重排字符串
随机推荐
高度塌陷问题的解决办法
图解LeetCode——640. 求解方程(难度:中等)
CSDN blog replacement skin
The 125th day of starting a business - a note
【愚公系列】2022年08月 Go教学课程 036-类型断言
“顶梁柱”滑坡、新增长极难担重任,阿里“蹲下”是为了跳更高?
Detailed explanation of VIT source code
Google search skills - programmer is recommended
树莓派入门(5)系统备份
重庆纸质发票再见!开住宿费电子发票即将全面取代酒店餐饮加油站发票
UNI-APP_iphone苹果手机底部安全区域
The thirteenth day of learning programming
Traversal of DOM tree-----modify styles, select elements, create and delete nodes
Economic Misunderstandings in the Crypto World: Is Cash a Savings?Scarcity creates value?
7 sorting algorithms that are often tested in interviews
The problem that Merge will be lost again after code Revert has been solved
高校就业管理系统设计与实现
C语言 recv()函数、recvfrom()函数、recvmsg()函数
Redis老了吗?Redis与Dragonfly性能比较
[BX]和loop