padding-bottom CSS property sets the height of the padding area on the bottom of an element.

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

An element's padding area is the space between its content and its border.

The effect of the CSS padding-bottom property on the element box

注意: padding property can be used to set paddings on all four sides of an element with a single declaration.

句法

/* <length> values */
padding-bottom: 0.5em;
padding-bottom: 0;
padding-bottom: 2cm;
/* <percentage> value */
padding-bottom: 10%;
/* Global values */
padding-bottom: inherit;
padding-bottom: initial;
padding-bottom: unset;
					

padding-bottom property is specified as a single value chosen from the list below. Unlike margins, negative values are not allowed for padding.

<length>

The size of the padding as a fixed value. Must be nonnegative.

<percentage>
The size of the padding as a percentage, relative to the width of the containing block. Must be nonnegative.

形式定义

初始值 0
适用于 all elements, except table-row-group , table-header-group , table-footer-group , table-row , table-column-group and table-column . It also applies to ::first-letter and ::first-line .
继承 no
百分比 refer to the width of the containing block
计算值 the percentage as specified or the absolute length
动画类型 a length

形式句法

<length> | <percentage>
					

范例

Setting padding bottom with pixels and percentages

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

规范

规范 状态 注释
CSS 基本 Box 模型
The definition of 'padding-bottom' in that specification.
工作草案 无变化。
CSS Level 2 (Revision 1)
The definition of 'padding-bottom' in that specification.
推荐 无变化。
CSS Level 1
The definition of 'padding-bottom' in that specification.
推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
padding-bottom Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 4 Opera 完整支持 3.5 Safari 完整支持 1 WebView Android 完整支持 ≤37 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 14 Safari iOS 完整支持 1 Samsung Internet Android 完整支持 1.0

图例

完整支持

完整支持

另请参阅

元数据

  • 最后修改: