You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > MozMarginStart

MozMarginStart style property | webkitMarginStart style property

Browser support:
MozMarginStart
webkitMarginStart
Specifies or retrieves the width of the left or the right margin, depends on the writing direction.
If the writing direction is set to left-to-right, use the marginLeft property, else use the marginRight property for cross-browser compatibility.

Syntax:

object.MozMarginStart;
object.webkitMarginStart;
You can find the related objects in the Supported by objects section below.
MozMarginStart: This property is read/write.
webkitMarginStart: This property is read/write.
CSS page for this property: -moz-margin-start

Possible values:

The type of this property is string.
 One of the following values: 
auto
Default. The sizes of the 'auto' margins are equal.
inherit
Takes the value of this property from the computed style of the parent element.
width in length
The width of the margin in length units. For the supported length units, see the length page.
width in percentage
The width is the specified percentage of the width of the parent element.
Default: 0.

Example HTML code 1:

This example illustrates the use of the -moz-margin-start and the -webkit-margin-start properties:
<head>
    <style>
        .ltr {
            direction: ltr;
            border: 2px solid red;
            -moz-margin-start : 20px;
            -webkit-margin-start : 20px;
        }
        .rtl {
            direction: rtl;
            border: 2px solid red;
            -moz-margin-start : 20px;
            -webkit-margin-start : 20px;
        }
    </style>
</head>
<body>
    <a style="border: 2px solid green;">previous object</a>
    <a class="ltr">margin-start: 20px (ltr)</a>
    <a style="border: 2px solid green;">next object</a>
    <br /><br />
    <a style="border: 2px solid green;">previous object</a>
    <a class="rtl">margin-start: 20px (rtl)</a>
    <a style="border: 2px solid green;">next object</a>
</body>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the MozMarginStart and webkitMarginStart properties in JavaScript:
<head>
    <script type="text/javascript">
        function ChangeMarginStart () {
            var anchor = document.getElementById ("myAnchor");
            var input = document.getElementById ("myInput");

            if ('MozMarginStart' in anchor.style) {
                anchor.style.MozMarginStart = input.value + "px";
            } else if ('webkitMarginStart' in anchor.style) {
                anchor.style.webkitMarginStart = input.value + "px";
            } else {
                alert ("Your browser doesn't support this example!");
            }
        }
    </script>
</head>
<body>
    <a id="myAnchor" style="border: 2px solid red;">anchor with margin</a>
    <a style="border: 2px solid green;">next object</a>

    <input id="myInput" type="text" value="40" />
    <button onclick="ChangeMarginStart ();">Change MozMarginStart!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content