CSS

填充底部 | padding-bottom

padding-bottom

CSS属性padding-bottom是指一个元素在内边距区域(padding area)中下方的高度。内边距(padding)是指一个元素的内容和边框之间的区域。和外边距(margin)不同,内边距(padding)是不允许有负值的。

/* <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.
是否是继承属性no
Percentagesrefer to the width of the containing block
适用媒体visual
计算值the percentage as specified or the absolute length
Animation typea length
正规顺序the unique non-ambiguous order defined by the formal grammar

语法

length当内边距(padding)大小是一个固定单位数值的时候,一定不能为负数。percentage当内边距(padding)是一个百分比的时候, 百分比是和本身包含的元素的宽度有关的,同样一定不能为负数。

正式语法

<length> | <percentage>

示例

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

规范

SpecificationStatusComment
CSS Basic Box ModelThe definition of 'padding-bottom' in that specification.Working DraftNo change from CSS Level 2 (Revision 1)The definition of 'padding-bottom' in that specification..
CSS TransitionsThe definition of 'padding-bottom' in that specification.Working DraftDefines padding-bottom as animatable.
CSS Level 2 (Revision 1)The definition of 'padding-bottom' in that specification.RecommendationNo change from CSS Level 1The definition of 'padding-bottom' in that specification..
CSS Level 1The definition of 'padding-bottom' in that specification.RecommendationInitial definition.

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support1.0(Yes)1.0 (1.0)4.03.51.0 (85)

FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support?(Yes)????