Name

margin-bottom, margin-left, margin-right, margin-top — NN 4 IE 4 CSS 1

Synopsis

Inherited: No

All four attributes set the width of a single margin edge of an element. A margin is space that extends beyond the element’s border and is not calculated as part of the element’s width or height.

CSS Syntax

margin-bottom: marginThickness | auto
margin-left: marginThickness | auto
margin-right: marginThickness | auto
margin-top: marginThickness | auto

JavaScript Equivalent

marginBottom
marginLeft
marginRight
marginTop

Value

Values for marginThickness can be lengths, percentages of the next outermost element size, or the auto constant.

Initial Value

0

Example

BLOCKQUOTE {margin-left: 20; margin-top: 10}
#narrowCol {margin-left: 30%; margin-right: 30%}

Applies To

All elements.

Object Model Reference

IE

[window.]document.all.elementID.style.marginBottom

[window.]document.all.elementID.style.marginLeft

[window.]document.all.elementID.style.marginRight

[window.]document.all.elementID.style.marginTop

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.