CSS's margin collapse

Source: Internet
Author: User

One, two div side by side, above Div's margin-bottom and below Div's margin-top will collapse, also said will take above Div's margin-bottom and the following Div's margin-top maximum value as the display value.
Workaround: Two div side-by-side, set only one of the blocks above or below the margin.


The parent Div Div contains the sub-block Div, and there is no border-top, padding-top, or overflow:hidden These CSS attributes for the child Div.
Workaround:
Set to Parent Div
1, Border:1pxsolidtransparent
2, Padding-top;
3, Over-flow:hidden;

Refer to:

Http://blog.chinaunix.net/uid-22414998-id-3138656.html
http://blog.csdn.net/dclchj/article/details/9787481

CSS's margin 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.