CSS Elementary tutorial boundary and padding

Source: Internet
Author: User

Border margin and supplemental white padding (according to the translation conventions of Chinese publishing houses, margin is translated into border, and padding is translated into supplementary White, and the translator translates according to the habit. However, the translator believes that, when margin is translated into an outer margin, padding is translated into an inner margin, which is more straightforward and image-oriented. You can adapt to these two different translations based on your habits. Is the two most common attributes used to separate elements. The boundary is the distance outside the element, while the padding is the internal distance of the element.
The improved code for h2 is as follows:

The code is as follows: Copy code
H2 {
Font-size: 1.5em;
Background-color: # ccc;
Margin: 1em;
Padding: 3em;

You can see that there is a character width on the outer side of the Level 2 title, which is very bloated because there are three character widths inside the Level 2 title.
You can set different values on the four sides of an element. Margin-top, margin-right, margin-bottom, margin-left, padding-top, padding-right, padding-bottom, and padding-left are attributes that do not need to be explained. meaning ).

 

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.