CSS margin-left Property


The margin-left CSS property specifies the width of the margin to the left of the desired element. This property can have negative values.

  • When it is desired that the margin be further away from its neighbours, a positive value is used.
  • When it is desired that the margin be placed closer, a negative value is used.

Syntax

Example

Preview

Property Values

Value Description
length Specifies a fixed left margin in pixels, points, centimeters, and so on. 0px is the default value. Negative values are permitted. Learn more about length units.
% Sets the left margin as a percentage of the width of the containing element.
auto A left margin is calculated by the browser.
initial This property is set to its default value.
inherit This property is inherited from its parent element.

Supported Browsers

Property Chrome Firefox Safari Edge / IE Opera
margin-left 1.0 1.0 1.0 6.0 3.5