BFC Layout Rules

Source: Internet
Author: User

BFC definition
BFC (block formatting context) literal translation is "blocks-level formatting up and down?". It's a unique rendering area, with only the Block-level box parameter
And, it specifies how the internal block-level box is laid out and irrelevant to the outside of the area.

BFC Layout Rules:
The inside box will be placed vertically, in a vertical direction, and then in a single place.
The distance from box vertical is determined by margin. A margin of two adjacent boxes belonging to the same BFC
The left side of each element's margin box is in contact with the left side of the containing block border box (or vice versa for formatting from left to right).
This is true even if there is a float.
The BFC area does not overlap with the float box.
BFC is?? An isolated container, a container? element does not affect the outer element. The reverse is true.
Floating elements also participate in calculations when calculating BFC degrees

Elements that can trigger BFC

root element
The Float property is not none
Position for absolute or fixed
Display for Inline-block, Table-cell, Table-caption, Flex, Inline-flex
The overflow is not visible


1. Clear internal float

2. Prevent vertical margin overlap

3. Adaptive two-column layout

BFC Layout Rules

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: 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.