document.ids.marginTop

JavaScript 1.2+ Nav4+ Syntax

document.ids.idName.marginTop

Description

The marginTop property specifies the distance between the top border of an element and the bottom border of another element. Dot notation is used to associate this property with the ID called idName.

Example

Listing 7.127 uses the marginTop property to set the distance between adjacent elements.

Listing 7.127 Set the Top Margin with the marginTop Property
 <html> <script> <!-- Hide //Create a style sheet id that defines the top margin document.classes.FORMAT.all.borderWidths(10); document.ids.margin.marginTop = 40; //Hide End ---> </script> <b>My margins are set automatically</b> <b class=FORMAT id=margin>I have a large top margin!</b> <b>My ...

Get Pure JavaScript 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.