Site icon DW Faisalabad

CSS margin-left Property

Set the left margin for a <p> element:

p {
margin-left: 2cm;
}

Try it Yourself »


Definition and Usage

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

Note: Negative values are allowed.

Default value: 0
Inherited: no
Animatable: yes, see individual propertiesRead about animatable – Try it
Version: CSS1
JavaScript syntax: object.style.marginLeft=”100px” Try it
CSS Syntax
margin-left: length|auto|initial|inherit;
Property Values
Value Description
length Specifies a fixed left margin in px, pt, cm, etc. Default value is 0px
% Specifies a left margin in percent of the width of the containing element
auto The browser calculates a left margin
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit
Exit mobile version