Property: |
padding |
Values: |
<length>, <percentage> |
Initial: |
not defined for shorthand properties |
Inherited: |
no |
A D V E R T I S E M E N T
The 'padding' property is a shorthand property for setting 'padding-top',
'padding-right', 'padding-bottom' and 'padding-left' at the same place in the
style sheet.
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:
H1 {
background: white;
padding: 1em 2em;
}
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.
Property: | padding-bottom |
Values: | <length>, <percentage> |
Initial: | 0 |
Inherited: | no | This property sets the bottom padding of an element.
BLOCKQUOTE { padding-bottom: 2em }
Property: | padding-left |
Values: | <length>, <percentage> |
Initial: | 0 |
Inherited: | no | This property sets the left padding of an element.
BLOCKQUOTE { padding-left: 20% }
Property: | padding-right |
Values: | <length>, <percentage> |
Initial: | 0 |
Inherited: | no | This property sets the right padding of an element.
BLOCKQUOTE { padding-right: 10px }
Padding values cannot be negative.
Property: | padding-top |
Values: | <length>, <percentage> |
Initial: | 0 |
Inherited: | no | This property sets the top padding of an element.
BLOCKQUOTE { padding-top: 0.3em }
|