Home >Web Front-end >CSS Tutorial >CSS study notes: Definition and use of parameters in Padding attribute_Experience exchange

CSS study notes: Definition and use of parameters in Padding attribute_Experience exchange

WBOY
WBOYOriginal
2016-05-16 12:05:541514browse

I have always been quite confused about the definition of the number of parameters in the Padding attribute in CSS, for example:
body { padding: 32px;}
body { padding: 32px 24px; }
body { padding: 32px 24px 18px ; }
body { padding: 32px 24px 18px 12px; }

Today Baidu viewed the CSS standard document, which stipulates this:
If only one is provided, it will be used for all four Side;
If two are provided, the first one is for top-bottom and the second one is for left-right;
If three are provided, the first one is for top and the second one is for left-right Right, and the third one is for bottom;
If all four parameter values ​​are provided, it will act on the four sides in the order of top-right-bottom-left.
body { padding: 36px;} //The patch margins on all four sides of the object are 36px
body { padding: 36px 24px; }
//The patch margins on the top and bottom sides are 36px, and the patches on the left and right sides are 36px. The margins are 24px
body { padding: 36px 24px 18px; }
//The patch margins on the top and bottom sides are 36px and 18px respectively, and the patch margins on the left and right sides are 24px
body { padding: 36px 24px 18px 12px; }
//The top, right, bottom and left patch margins are 36px, 24px, 18px, 12px respectively

Make a mark, I forgot.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn