What is BFC and what is a good wife?

Source: Internet
Author: User

What is BFC and what is a good wife?

BFC Definition
The BFC (Block formatting context) literal translation is "Block-level formatting context ". It is a stand-alone rendering area with only Block-level box parameters. It specifies how the internal Block-level Box is laid out and has nothing to do with the outside of this area.
BFC layout rules:
The internal Box will be placed in the vertical direction, and placed one by one. The vertical distance of the Box is determined by margin. The margin of two adjacent boxes belonging to a BFC in the same region will generate the left side of the margin Box that overlaps each element, it is in contact with the left side of the border box containing blocks (for formatting from left to right, otherwise it is opposite ). This is true even if floating occurs. The BFC region does not overlap with the float box. BFC is an isolated stand-alone container on the worker page. The sub-elements of the worker in the container worker do not affect the elements of the external worker. And vice versa. Floating elements are also involved in the calculation when the height of the BFC Shard is calculated.
Second, what elements will be used to generate BFC?
Root element

The float attribute is not none.

Position is absolute or fixed

Display is inline-block, table-cell, table-caption, flex, inline-flex

Overflow is not visible

BFC is an isolated stand-alone container on the worker page. The sub-elements of the worker in the container worker do not affect the elements of the external worker. And vice versa.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.