padding-bottom
CSS 属性 padding-bottom 是指一个元素在内边距区域(padding area)中下方的高度。内边距(padding)是指一个元素的内容和边框之间的区域。和外边距(margin)不同,内边距(padding)是不允许有负值的。内边距(padding)可以用四个值声明一个元素的四个方向的内边距(paddings),这是一种 CSS 缩写属性。
/* <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;
初始值 | 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 . |
是否是继承属性 | 否 |
Percentages | refer to the width of the containing block |
计算值 | the percentage as specified or the absolute length |
Animation type | a length |
Syntax
Values
length
-
当内边距(padding)大小是一个固定单位数值的时候,一定不能为负数。
percentage
-
当内边距(padding)是一个百分比的时候,百分比是和本身包含的元素的宽度有关的,同样一定不能为负数。
Formal syntax
padding-bottom =
<length-percentage [0,∞]>
<length-percentage> =
<length> |
<percentage>
Examples
.content { padding-bottom: 5%; } .sidebox { padding-bottom: 10px; }
Specifications
Specification |
---|
CSS Box Model Module Level 3 # padding-physical |
Browser compatibility
BCD tables only load in the browser
See also
- CSS Box Model
- The
padding
shorthand property can be used to set paddings on all four sides of an element with a single declaration:padding-top
,padding-right
,padding-bottom
, andpadding-left
.