33 lines
662 B
Markdown
33 lines
662 B
Markdown
---
|
||
title: Add Different Padding to Each Side of an Element
|
||
localeTitle: 在元素的每一侧添加不同的填充
|
||
---
|
||
## 在元素的每一侧添加不同的填充
|
||
|
||
要调整元素的填充,请使用:
|
||
|
||
```css
|
||
.example {
|
||
padding: 10px;
|
||
}
|
||
```
|
||
|
||
要通过单个面指定元素的填充大小,我们可以使用“padding-top”,“padding-right”,“padding-bottom”和“padding-left”。我们可以以任何顺序组合使用这些中的任何一种。例如:
|
||
|
||
```css
|
||
.example {
|
||
padding-top: 5px;
|
||
padding-bottom: 0px;
|
||
}
|
||
```
|
||
|
||
要么:
|
||
|
||
```css
|
||
.example {
|
||
padding-top: 20px;
|
||
padding-left: 25px;
|
||
padding-right: 5px;
|
||
}
|
||
|
||
``` |