Clear floating clear/BFC

Source: Internet
Author: User

There are two methods to clear floating: 1. Clear

Clear: Both/left/right;

Ii. Create BFC

(1) What is BFC?

BFC is a block-level formatting context. It is an independent rendering area and only involves block-level box. It specifies how the internal block-level box is laid out, it is irrelevant to the outside of this region. In general, it is equivalent to a container that boxes floating elements and isolates them,The sub-elements in the container do not affect the external elements,So that the floating will not overflow.

(2) What elements will generate BFC?

① Root element or other elements containing it

② The float value is not none.

③ The value of overflow is not visible.

④ The value of display is inline-block/table-cell (table cell)/table-caption (Table title)/flex/inline-flex

⑤ Position value: absolute/fixed

(3) What are the functions of BFC?

BFC can be used in additionClear floating, Can also be usedPrevent margin folding,Left and right columnsThese two functions.

Clear floating clear/BFC

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.