padding
The space inside an element between its content and its border, filled with the element's background.
In more detail
Padding cannot be negative. Under content-box sizing, padding makes the element bigger than its declared width; under border-box it is taken from inside the width.
Related terms
- CSS box model — The rule that every element is drawn as a rectangle made of four layers: content, then padding, then border, then margin.
- border — The line drawn around an element's padding, with its own width, style and colour.
- margin — Transparent space outside an element's border that pushes neighbouring elements away.
- box-sizing — The CSS property that decides whether width and height measure only the content (content-box) or include padding and border (border-box).
Taught in
- Modern Box Model, Box Sizing, Display Types And Flow Layout — Frontend Architecture & Web Platform