CSS Property - Padding

Value: [ <length> | <percentage> ]{1,4}
Initial: not defined for shorthand properties
Applies to: all elements
Inherited: no
Percentage values: refer to width of closest block-level ancestor

The CSS property "padding" is a shortend version for setting the individual padding properties in one string in a style sheet or as an inline style in a HTML document:

If four values are specified they apply to top, right, bottom and left respectively. If there is only one value, it applies to all sides, if there are two or three, the missing values are taken from the opposite side.

The surface of the padding area is set with the "background" property:

Example:

h1{
padding: 1em 2em;
background: #FFFFFF;
}

The example above sets a "1em" padding vertically ("padding-top" and "padding-bottom") and a "2em" padding horizontally ("padding-right" and "padding-left").

The "em" unit is relative to the element"s font size: "1em" is equal to the size of the font in use.

Padding values cannot be negative.