CSS margin-left property
- previous page margin-inline-start
- Next Page margin-right
Definition and Usage
The margin-left property sets the left outer margin of the element.
Note:Negative values can be used.
See Also:
CSS Tutorial:CSS Margin
HTML DOM Reference Manual:marginLeft Property
Examples
Set the left outer margin of the p element:
p margin-left:2cm; }
(More examples can be found at the bottom of the page)
CSS Syntax
margin-left: length|auto|initial|inherit;
Property Value
Value | Description |
---|---|
auto | The left outer margin set by the browser. |
length | Specifies a fixed left outer margin. The default value is 0. |
% | Specifies the left outer margin as a percentage of the width of the containing element. |
inherit | Specifies that the left outer margin should be inherited from the parent element. |
Technical Details
Default Value: | 0 |
---|---|
Inheritance: | no |
Version: | CSS1 |
JavaScript Syntax: | object |
More Examples
- Set the left outer margin of text to 1
- This example demonstrates how to set the left margin of text using centimeter values.
- Set the left outer margin of text to 2
- This example demonstrates how to set the left margin of text using percentage values.
Browser Support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
1.0 | 6.0 | 1.0 | 1.0 | 3.5 |
- previous page margin-inline-start
- Next Page margin-right