Browser | Internet Explorer | Netscape | Opera | Safari | Firefox | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Version | 5.5 | 6.0 | 7.0 | 8.0 | 8.0 | 9.0 | 7.0 | 8.0 | 9.2 | 9.5 | 1.3 | 2.0 | 3.1 | 1.5 | 2.0 | 3.0 |
Supported | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Short information
CSS | CSS1 |
---|---|
Default value | 0 |
Inherited | No |
Applied | To all elements |
HTML analog | No |
Reference to specification | http://www.w3.org/TR/CSS21/box.html#propdef-margin-left |
Description
It determines an indentation size from the left margin of an element. A space is the distance from external margin of the current element left margin to internal margin of its parental element (fig. 1).
It determines an indentation size from the left margin of an element. A space is the distance from external margin of the current element left margin to internal margin of its parental element (fig. 1).
Syntax
margin-left: value | auto
Arguments
You can specify size of the left indentation in pixels (px), percent (%) or other admissible units for CSS. Value can be both positive and a negative number. The argument auto specifies that the indentation size will be automatically calculated by a browser.
You can specify size of the left indentation in pixels (px), percent (%) or other admissible units for CSS. Value can be both positive and a negative number. The argument auto specifies that the indentation size will be automatically calculated by a browser.
Example
<!-- .layer1 { background-color: #D36037; /* Background color */ } .layer2 { margin-left: 20%; /* Left margin */ background-color: #ccc; /* Background color */ padding: 10px; /* Areas around the text */ } --> <div class="layer1"> <div class="layer2"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat. Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</div> </div>
The result of this example is shown on the figure 2
Object model
[window.]document.getElementById("elementID").style.marginLeft