{margin-top:} Margin-Top Property - CSS Property Reference :: webDev

{margin-top:}


						margin-top: { length | percentage | auto | inherit } ;
					

The {margin-top:} property defines the vertical distance from the top border edge of an element to the edge of its containing block, or the element that’s vertically adjacent above it. Its effect is also dependent on other factors, such as the presence of collapsing margins on vertically adjacent elements.

If the element above the element in question is floated, or absolutely positioned, the top margin will pass through the floated element, because floats and absolute elements are removed from the flow. The {margin:} will only be affected by static elements (or elements for which {position:} is set to {relative;}, and which have no coordinates) in the normal flow of the document—this includes the containing block itself.

Vertical {margin}s will have no effect on non-replaced inline elements.

IE 6 in some instances incorrectly bases vertical margin percentage values on the {width:} of the <body>, rather than the containing block.

IE for Windows versions up to and including 7 differ in their handling of margin collapse from the CSS2.1 specifications.

IE for Windows versions up to and including 7 don't support the value {inherit;}.

{margin-top:} Margin-Top Property - CSS Property Reference :: webDev