Block-level formatting context (block formatting contexts)

Source: Internet
Author: User

So how do you trigger BFC?

    • Float value other than none
    • Overflow values other than visible (Hidden,auto,scroll)
    • Display (Table-cell,table-caption,inline-block)
    • Position (absolute,fixed)
    • FieldSet elements

Features of the BFC:

1) block level formatting context blocks margin overlays

When two adjacent block boxes are in the same block-level formatting context, the vertical margin between them will overlap. In other words, if the two adjacent block boxes do not belong to the same block-level formatting context, their margins are not superimposed.

2) block-level formatting contexts do not overlap floating elements

As a rule, the bounding rectangle of a block-level formatting context cannot overlap the margins of the elements inside it. This means that the browser will create an implicit margin for the block-level formatting context to prevent it from overlapping the margin of the floating element. For this reason, it will not work when you add a negative margin to a block-level formatting context that is next to floating (WebKit and IE6 have a problem at this point-you can see this test case).

3) block-level formatting contexts can often contain floating

See: css2.1-10.6.7 ' Auto ' Heights for block formatting context roots

In layman's terms: the element that created the BFC is a separate box in which the child elements do not affect the outside elements on the layout, and vice versa, while BFC still belong to the normal flow in the document.

Excerpt from: http://www.iyunlu.com/view/css-xhtml/55.html

Block-level formatting context (block formatting contexts)

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.