CSS margin-leftProperty


Example

Set the left margin of a p element:

p { margin-left:2cm; }

Try it Yourself »

Property definition and usage instructions

The margin-left property sets the left margin of an element.

Note:Negative values are allowed.

Default value: 0
Inherited: no
version: CSS1
JavaScript Syntax: object.style.marginLeft="10px"


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
margin-left 1.0 6.0 1.0 1.0 3.5

Property value

Value Description
auto Left margin set by the browser.
length Defines a fixed left margin. The default value is 0.
% Defines a percentage-based left margin relative to the total width of the parent object.
inherit Specifies that the left margin should be inherited from the parent element.


Related Articles

CSS Tutorial:CSS Margin

other extensions