freeCodeCamp/guide/chinese/css/properties/padding-property/index.md

17 lines
904 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Padding Property
localeTitle: 填充属性
---
## 填充属性
CSS `padding`属性在元素的内容和边框之间添加内部空间。您可以对元素的特定边使用`padding-top` `padding-right` `padding-bottom`和`padding-left` ,但`padding`是所有这些属性的简写版本。如果:
* 提供一个值,它将适用于元素的所有方面
* 提供两个值,第一个值将应用顶部和底部,第二个值将应用于元素的左侧和右侧。
* 提供三个值,第一个值将应用于顶部,第二个值将应用于左侧和右侧,第三个值将应用于元素的底部。
* 提供了四个值,值将按以下顺序应用:顶部,右侧,底部,左侧。
#### 更多信息:
* [MDN - 填充](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)
* [CSS-Tricks - 填充](https://css-tricks.com/almanac/properties/p/padding/)