Home > Article > Web Front-end > What does padding mean in css
In CSS, padding is a property used to add white space around elements. It is used to increase space between elements, create padding, align elements, and create visual hierarchy.
What is padding in CSS?
In CSS, padding is a property used to add white (transparent) area around an element. It can be specified by four values (top, right, bottom, left), or by a single value specifying all margins.
Usage of padding
The value of padding can be specified as pixels (px), percentage (%), em, or rem. The syntax is as follows:
<code>padding: <top> <right> <bottom> <left>;</code>
For example:
padding: 10px;
: Adds 10px of whitespace to all margins. padding: 10px 20px;
: Add 10px padding at the top and bottom, and 20px padding on the left and right sides. padding: 10% 5%;
: Add 10% of the element's height to the top and bottom, and 5% of the element's width to the left and right sides. The role of padding
padding is mainly used in the following aspects:
The above is the detailed content of What does padding mean in css. For more information, please follow other related articles on the PHP Chinese website!