paddingNN 4 IE 4 CSS 1

Inherited: No

This is a shortcut attribute that can set the padding widths of up to four edges of an element with one statement. Padding is space that extends around the content box of an element up to but not including any border that may be specified for the element. Padding picks up the background image or color of its element. As you add padding to an element, you increase the size of the visible rectangle of the element without affecting the content block size. You may supply one to four space-delimited padding values. The number of values determines which sides receive the assigned padding.

 
CSS Syntax
 
padding: paddingThickness {1,4}
 
Value

This attribute accepts one, two, three, or four values, depending on how many and which sides you want to assign padding to. Values for paddingThickness can be lengths or percentages of the next outermost element size. Value quantities and positions are interpreted as follows.

Number of valuesEffect
1All four padding edges set to value
2Top and bottom padding set to the first value, right and left padding set to the second value
3Top padding set to first value, right and left padding set to second value, bottom padding set to third value
4Top, right, bottom, and left padding set, respectively
 
Initial Value

0; IE for Windows specifies a default value of 1 for td and th elements.

 
Example
 
p.highlight {padding: 10px 20px}
 
Applies To

All elements (IE 5 for Macintosh, IE 5.5 for Windows, and Netscape 6); body, caption, div, iframe, marquee, table, td, textarea, tr, and elements (IE 5 and earlier for Windows).

 
Object Model Reference
 
[window.]document.getElementById("elementID").style.padding