CSS Reference ยท Box Model and Sizing
The padding-bottom property
Reference for the CSS padding-bottom property: syntax, values, percentages, effect on box height, examples and browser support.
The padding-bottom property sets the space between an element's content and its bottom border. The background fills the space, so it makes the box taller without adding any gap between it and the next element.
CSS
.card { padding-bottom: 1.5rem; }
Try it
Syntax
CSS
padding-bottom: <length> | <percentage>
- Initial value:
0 - Applies to: all elements except internal table row groups, header groups, footer groups, rows and column groups
- Inherited: no
- Percentages: relative to the width of the containing block
- Animatable: yes
- Computed value: the percentage as specified or the absolute length
Values
| Value | Description |
|---|---|
<length> |
A fixed size such as 20px or 1.5rem. Must not be negative. |
<percentage> |
A share of the containing block's width. |
Usage notes
- Padding or margin? Padding is inside the border and shows the background;
margin-bottomis outside and transparent. Use padding to enlarge the box itself, margin to separate boxes. - Stopping margin collapse. Giving a parent any
padding-bottom(even1px) keeps its last child's bottom margin from collapsing through it. - Fixed height boxes. With
box-sizing: border-boxand a setheight, the padding reduces the room for content, so text can overflow sooner. - Scrolling pages. Extra
padding-bottomon the main container keeps content from hiding behind a fixed footer or a mobile browser toolbar. - Inline elements paint the background lower but the line height does not change.
Browser support
Supported in every browser.
Related
paddingโ the shorthandpadding-top,padding-left,padding-rightmargin-bottom- Lesson: Padding