HTML & CSS Wiki

READ MORE

HTML & CSS Wiki

The margin-left property is used in CSS and certain HTML elements. It sets the margin space required on the left side of an element. A negative value is also allowed. The margin property is the shorthand property for setting the margin for all sides, or individual sides, of an element. Other properties for setting the other margins are margin-bottom, margin-top, and margin-right.


Values[]

Value Description
<length> Specifies a fixed width. Examples of lengths are: pt, px, em, etc.
<percentage> A <percentage> is always relative to the width of the containing block.
auto See the auto value for margin.


HTML example:

<h1 style="margin-left:5px;">
1st heading content.
</h1>


CSS example:

h1 {
    margin-left:5px;
}

See Also[]