Name
padding
Synopsis
This shorthand property sets the width of the overall padding for an element or sets the widths of each individual side padding. Padding set on inline nonreplaced elements does not affect line-height calculations; therefore, such an element with both padding and a background may visibly extend into other lines and potentially overlap other content. The background of the element will extend throughout the padding. Negative padding values are not permitted.
Values:
[ <length> | <percentage> ]{1,4} |
inherit
Initial value:
not defined for shorthand elements
Applies to:
all elements
Inherited:
no
Percentages:
refer to the width of the containing block
Computed value:
see individual properties (padding-top, etc.)
Note:
padding can never be negative
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access