On this page
padding
Prev: `margin` | Up: box_model | Next: `aspect-ratio`
Rel: box_model, Box Model & Sizing Guide
Ref: MDN Web Docs — padding
Tags: #public #web #css #properties #box_model #tier/core
Syntax & Overview
padding: 1rem 1.5rem; /* logical: padding-inline, padding-block */
Inner spacing between content and border (never collapses, never negative).
- Initial:
0| Inherited: No | Animatable: Yes
Notes & Best Practices
- Always uses the element's own background (unlike
margin), and never accepts negative values. Usepadding-inline/padding-blockfor logical directionality.
Example
.btn {
padding-block: 0.5rem;
padding-inline: 1rem;
}
Linked from
Related notes
- tuts/css/properties/box_model/aspect-ratio Linked here; links to this page; shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/margin Linked here; links to this page; shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model Linked here; links to this page; shared tags: #css, #properties, #web
- tuts/css/properties/box_model_and_sizing Linked here; shared tags: #css, #properties, #web
- tuts/css/properties/box_model/box-sizing shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/inline-size shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/overflow shared tags: #css, #properties, #tier, #web
- tuts/css/properties/layout/align-items shared tags: #css, #properties, #tier, #web
- tuts/css/properties/layout/display shared tags: #css, #properties, #tier, #web
- tuts/css/properties/layout/flex shared tags: #css, #properties, #tier, #web