Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS margin-left property


May 05, 2021 CSS Reference Manual


Table of contents


CSS margin-left property


Set the left margin of a p element:

P
{
margin-left:2cm;
}

Try it out . . .

Description of property definition and use

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

Note: Negative values are allowed.

Default: 0
Inherited: no
Version: CSS1
JavaScript syntax: object .style.marginLeft="10px"


Browser support

The numbers in the table support the first browser version number of the property.

Attributes
margin-left 1.0 6.0 1.0 1.0 3.5

The property value

Value Describe
auto The left margin of the browser settings.
length Defines a fixed left margin. The default is 0.
% Defines the left margin based on the percentage of the total height of the parent object.
inherit Specifies that the left margin should be inherited from the parent element.


Related articles

CSS tutorial: CSS Margin