Definition of the number of parameters for Attribute padding in CSS

Source: Internet
Author: User

I have never understood the setting of the padding attribute value.

I can understand this.

For example:
Body {padding: 36px ;}
Body {padding: 36px 24px ;}

Body {padding: 36px 24px 18px ;}
Body {padding: 36px 24px 18px 12px ;}

I checked the standard CSS document, which is as follows:

 
If only one edge is provided, all four edges are used;
If two values are provided, the first value is used for top-bottom and the second value is used for left-right;

If three are provided, the first is used for the top, the second is used for the left-right, and the third is used for the bottom;
If all four parameter values are provided, the top-right-bottom-left parameters are added to the four sides.


body {padding: 36px ;}
// The patch margin of the four sides of the object is 36px
body {padding: 36px 24px;}
// The patch margin of the upper and lower sides is 36px, the patch margins on the left and right sides are 24px
body {padding: 36px 24px 18px;
}// the patch margins on the top and bottom are 36px and 18px respectively, the patch margin on both sides is 24px
body {padding: 36px
24px 18px 12px ;} // The top, right, bottom, and left patch margins are 36px, 24px, 18px, and 12px respectively.

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.