My understanding of the CSS margin merging

Source: Internet
Author: User
Tags touch

Today, by talking to some of the younger brothers, they find that they are not very understanding of the merger of the outside margin.

In fact, a simple analysis of the outside of the CSS integration, it is easy to understand how it is. But if you want to get a better understanding of the magical nature of margin, it's going to be a time-consuming effort.

I'm a rookie, and it's certainly not too complicated here, I just want to talk about my understanding of the integration of the outer space.

In fact, to understand what is the outer Space merger, the easiest way is to try it yourself. In my opinion, the key to understanding the integration of the outer space is to understand the sentence: "As long as the contact, the merger."

What do you mean, "just touch, merge"? In fact, it is understood that when the outer distance of two elements is contacted, they are fused. When will you be able to touch it? is when two elements do not have border properties and inner margin properties.

Or don't you understand? That's not what I can do. Because you don't understand what a box model is.

In fact, the outside of the CSS integration is such a little thing. I take out is because, read a lot of people's code, like to margin and padding mixed together. Whether using padding or margin, as long as the final display of the effect and their own imagination of the same, they feel that they have achieved their goal. Sometimes with margin, you encounter a margin merge but don't know what's going on, or don't know how to solve it, and then come up with ways to "make" what you want (such as adding an empty element to open and white). But in fact, I would like to say that the use of margin and padding, it is not the padding and margin of the original plan.

Well, a little spit, and do not want to say anything, because others write more in-depth than I more detailed. The address of several articles here will help you to deepen your understanding of the use of margin and padding.

Related Article

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.