CSS margin-left property
Examples
Setting a p element left margin:
p
{
margin-left: 2cm;
}
{
margin-left: 2cm;
}
Attribute definitions and instructions
margin-left property to the left of an element.
Note: negative values are allowed.
Defaults: | 0 |
---|---|
inherit: | no |
version: | CSS1 |
JavaScript syntax: | object .style.marginLeft = "10px" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
margin-left | 1.0 | 6.0 | 1.0 | 1.0 | 3.5 |
Property Value
value | description |
---|---|
auto | Left outside the browser settings pitch. |
length | It defines a fixed left margin. The default value is 0. |
% | Definition is based on a percentage of the total height of the parent object left margin. |
inherit | Provision should extend from the left margin of the parent element. |
related articles
CSS tutorial: CSS Margin