padding-bottom CSS 属性设置了元素底部内边距区域的高度。

{{InteractiveExample("CSS Demo: padding-bottom")}}

```css interactive-example-choice padding-bottom: 1em;


```css interactive-example-choice padding-bottom: 10%;

```css interactive-example-choice padding-bottom: 20px;


```css interactive-example-choice padding-bottom: 1ch;

```css interactive-example-choice padding-bottom: 0;


```html interactive-example <section id="default-example"> <div class="transition-all" id="example-element"> <div class="box"> Far out in the uncharted backwaters of the unfashionable end of the western spiral arm of the Galaxy lies a small unregarded yellow sun. </div> </div> </section>

```css interactive-example

example-element {

border: 10px solid #ffc129; overflow: hidden; text-align: left; }

.box { border: dashed 1px; }


内边距区域是指一个元素的内容和边框之间的区域。 ![CSS padding-bottom 属性对元素盒子的影响](padding-bottom.svg) > [!NOTE] > 通过 {{cssxref("padding")}} 属性,只需一次声明,就可以为元素的所有四边设置内边距。 ## 语法 ```css /* <length> 值 */ padding-bottom: 0.5em; padding-bottom: 0; padding-bottom: 2cm; /* <percentage> 值 */ padding-bottom: 10%; /* 全局值 */ padding-bottom: inherit; padding-bottom: initial; padding-bottom: revert; padding-bottom: revert-layer; padding-bottom: unset;

padding-bottom 属性可以从下面的列表中指定一个值。与 margin 不同,padding 不允许使用负值。

  • {{cssxref("<length>")}}
    • : 作为定值的内边距尺寸。必须是非负值。
  • {{cssxref("<percentage>")}}
    • : 相对于包含块的行内尺寸(水平语言中的宽度,由 {{cssxref("writing-mode")}} 定义)的百分比。必须是非负值。

形式定义

{{cssinfo}}

形式语法

{{csssyntax}}

示例

使用像素和百分比值设置下内边距

.content {
  padding-bottom: 5%;
}
.sidebox {
  padding-bottom: 10px;
}