Name

marginRight, marginTop — NN n/a IE 4 DOM n/a

Synopsis

Read/Write

All four properties 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.

Example

document.all.logoWrapper.style.marginTop = "5px"
document.all.navPanel.style.marginLeft = "10%"

Value

Values for margin widths can be length values, percentages of the next outermost element size, or the auto constant.

Default

0

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.