CSS margin-left Property
CSS margin-left
property sets the left margin of an element.
Usages
The following table outline the usages and version history of this property.
Default value: | 0 |
Applies to: | All elements except display: table , display: table-caption , display: inline-table |
Inherited: | No |
Version: | CSS1 |
JavaScript Syntax: | object.style.marginRight = "40px" |
Syntax
Here is a syntax for the CSS margin-left
property
margin-left: length | percentage | auto | initial | inherit;
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
length | Specifies the length value expressed in px, pt, cm, em, etc. Negative values are also allowed |
percentage | Specifies the percentage value relative to the width of the element containing block |
auto | browser calculates a suitable value for the element |
initial | Sets default value of this property |
inherit | Inherits this property from its parent element. |
Examples
The example below shows to sets margin left values of the element.
.margin-1 {
margin-left: 40px;
}
Browser Compatibility
- Google Chrome 1+
- Mozilla Firefox 1+
- Internet Explorer 6+
- Opera 3.5+
- Safari 1+
Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.