marginLeft Property

Sets or returns a String that represents the width of the left margin of the object. Corresponds to the marginLeft property of an inline style attribute.

expression.MarginLeft

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Remarks

The String for the marginLeft property can be one of the following values:

Value Description
auto Left margin measurement is the default setting.

The following code sets the left margin in the active document to the default setting.

ActiveDocument.body.Style.marginLeft = "auto"
width Floating-point number, followed by an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex).

The following code sets the left margin of the active document to 50 pixels.

ActiveDocument.body.Style.marginLeft = "50px"
percentage Integer, followed by a %. The value is a percentage of the width of the parent object.

The following code sets the left margin to 10 percent of the width of the browser window.

ActiveDocument.body.Style.marginLeft = "10%"

You can also use the margin property to set all margins at the same time or to set all margins to the same setting. For example, the following code does the same as the example below but uses the margin property.

ActiveDocument.body.Style.margin = "auto 25px 2px 50px"

Example

The following example sets the top, right, bottom, and left margins for the active document.

With ActiveDocument.body.Style
    .MarginTop = "auto"
    .MarginRight = "25px"
    .MarginBottom = "1%"
    .MarginLeft = "50px"
End With

Applies to | FPHTMLStyle Object | IFPStyleState Object | IHTMLRuleStyle Object | IHTMLStyle Object