CSS marginleft Property (original) (raw)

CSS margin-left Property

Last Updated : 28 May, 2026

The margin-left property in CSS is used to set the space on the left side of an element. It helps control the positioning and spacing of elements in a webpage layout.

**Syntax:

margin-left: length | auto | initial | inherit;

**Default Value: Its default value is 0.

**Property values:

margin-left: 15px;

**Example 1:

html `

CSS | margin-left Property

This paragraph has 15px margin .

`

**Example 2:

html `

CSS | margin-left Property

This paragraph has 20% margin .

`

margin-left: auto;

**Example:

html `

CSS | margin-left Property

This paragraph has auto margin .

`

margin-left: initial;

**Example:

html `

CSS | margin-left Property

This paragraph has initial margin .

`

margin-left: inherit;

**Example 1:

html `

CSS | margin-left Property

This paragraph has auto margin .

`

**Example 2:

html `

CSS | margin-left Property

This paragraph has auto margin .

  <p style = "margin-left:10px; border-style:solid ; 
              border-color:black;">
     This paragraph has 10px margin.
  </p>
  <br>
  
  <p style = "margin-left:5%;border-style:solid; 
              border-color: black;">
     This paragraph has 5% margin.
  </p>
  <br>
  
  <p style = "margin-left:15px; border-style:solid;
              border-color: black;">
     This text has an margin of 15px.
  </p>
  <br><br>   

  <p style = "margin-left:initial;border-style:solid;
              border-color: black;">
     This text has a margin of default
     typeset by initial
  </p>   

`