marginNN 4   IE 4   CSS 1
 Inherited: No
 

A shortcut attribute that can set the margin widths of up to four edges of an element with one statement. A margin is space that extends beyond the border of an element to provide extra empty space between adjacent or nested elements, especially those that have border attributes set. You may supply one to four space-delimited margin values. The number of values determines which sides receive the assigned margins.

 
CSS Syntax
margin: marginThickness | auto {1,4}
 
JavaScript Equivalent
margins()
 
Value
This attribute accepts one, two, three, or four values, depending on how many and which margins you want to set. Values for marginThickness can be lengths, percentages of the next outermost element size, or the auto constant. Value quantities and positions are interpreted as follows:
Number of Values Effect
1 All four margin edges set to value
2 Top and bottom margins set to the first value, right and left margins set to the second value
3 Top margin set to first value, right and left margins set to second value, bottom margin set to third value
4 Top, right, bottom, and left margin set, respectively
 
Initial Value
0
 
Example
P.highlight {margin: 10px 20px}
 
Applies To
All elements.
 
Object Model Reference
IE [window.]document.all.elementID.style.margin
Hosted by uCoz