Understanding of padding and margin

Source: Internet
Author: User

I read my blog about padding margin today. Very useful, original link http://www.hicss.net/use-margin-or-padding/ (haiyu blog ).

Some other negative margin application blog: http://www.hicss.net/do-not-tell-me-you-understand-margin/,http://www.hicss.net/i-know-you-do-not-know-the-negative-margin/

Http://www.topcss.org /? P = 94

In order to better understand the situation, haiyu is set to padding and margin:

Margin is used to separate the spacing between elements and elements;

Padding is used to separate the spacing between elements and content;

Margin is used to separate la s because elements and elements are irrelevant;

Padding is used for the interval between elements and content, so that there is a "breathing distance" between content (text) and (Package) elements"


When to use margin:

When adding a blank space outside the border.

When no background (color) is required in the blank area.

The white space of the two boxes connected up and down, such as 15px +The margin of 20px will get the blank of 20px.


When to use padding:

When adding a blank space on the inside of border.

Blank space requiredWhen the background (color) is required.

The space between the two boxes that love to be connected must be equal to the time between the two.For example, 15px +20px
In the left-side navigation pane.

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.