Margin collapse (parent-child element collapse)

Source: Internet
Author: User

Description The first figure is a collapsed diagram, and the second diagram is the resolved one.

1, parent element maigin-top and child element margin-top collapse: set border or padding or create BFC

2, Big brothers margin-Bottom and two brothers margin-top collapse: Create BFC

                                                     

3. Child element float-> Parent element height collapse: pseudo-class clear floating or create BFC

4, Big Brothers float-> two brothers surround: pseudo class clear floating or create BFC

Attached: How to create BFC:

  • Float:left/right
  • Position:absolute/fixed
  • Display:inline-block/table-cell/table-caption
  • Overflow:hidden/auto/scroll

Bfc:http://www.cnblogs.com/uncle-keith/p/6158136.html

Margin collapse (parent-child element collapse)

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.