padding Description:
The padding property is a shorthand property that defines the padding on all sides of an element.
padding in CSS Versions:
padding Syntax:
padding: [ <length> | <percentage> ]{1,4}
padding: <padding-top> <padding-right> <padding-bottom> <padding-left>
length
A specific length (include unit of measure).percentage
A percentage of the height of the closest block-level ancestor.
padding Initial Value:
No initial value is defined for shorthand properties.
padding Applies To:
padding Inheritance:
This property is not inherited.
padding Browser Support:
- AvantGo Palm OS
- AvantGo Windows CE
- Chrome 1, 2, 3, 4, 5, 6, 7, 8, 9
- Firefox 1, 2, 3, 4
- Internet Explorer 2, 3, 4, 5, 6, 7, 8, 9
- Netscape 2, 3, 4, 6, 7, 8
- Opera 3, 4, 5, 6, 7, 8, 9, 10, 11
- Safari 1, 2, 3, 4, 5
- WebTV/MSN TV
padding Examples:
standard padding
<p style="padding : 2em;">
This paragraph has a 2 em top padding.
</p>
set top and bottom the same and right and left the same
<p style="padding : 2em 1em;">
This paragraph has a 2 em padding on the top and bottom and a 1em padding on the right and left.
</p>
padding Special Notes:
- Negative values are not permitted.
- The padding will inherit the background properties, such as color or background image of the element.

