Style.marginLeft Property

SharePoint Designer Developer Reference

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

Syntax

expression.MarginLeft

expression   Required. A variable that represents a Style object.

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.

Visual Basic for Applications
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.

Visual Basic for Applications
ActiveDocument.body.Style.marginLeft = "50px"
percentage

Integer, followed by a percent sign (%). 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.

Visual Basic for Applications
ActiveDocument.body.Style.marginLeft = "10%"

Note

You can also use the margin property to set all margins at the same time or to set all margins to the same setting.

See Also