What CSS property adds space inside an element's border?
Answer
padding
Answer
padding
The CSS property that adds space inside an element’s border is padding.
Padding creates the gap between an element’s content and its border. It can be set for all four sides with padding: 12px, or independently with properties such as padding-top and padding-inline. Unlike margin, padding is part of the element’s box and receives the element’s background color or image.
The CSS box model places content at the center, followed outward by padding, border, and margin. This explains the most common confusion: margin adds space outside the border, while padding adds space inside it. An outline is drawn outside the border but does not occupy layout space, and border-spacing is mainly used to control gaps between table cells.
With the default box-sizing: content-box, declared width and height apply to the content area, so padding increases the rendered outer size. With box-sizing: border-box, the declared dimensions include padding and border, which often makes responsive layouts easier to calculate. Padding is especially important for making buttons and links easier to tap without adding extra elements.
Source: Wikipedia · fact-checked Aug. 2026