The margin-left property sets the margin area on the left of an element. A positive value moves the box farther from neighbors on the left; a negative value pulls it closer.
It is part of the box model (outside the border), is not inherited, and always targets the physical left edge. Prefer margin-inline-start when spacing should follow text direction (LTR/RTL).
Baseline · Widely available.
Not deprecated. Core length, percentage, and auto values work across modern browsers.
Syntax
CSS Syntax
syntax.css
margin-left:<length> | <percentage> | auto | inherit;
Example: margin-left: 1.5rem;. Values may be positive, zero, or negative.
Give the box a width so free space exists in the parent.
Set margin-left: auto. Unused space goes to the left.
The box moves right inside the container.
Both sides auto (margin-left and margin-right) centers the box instead.
Edge Cases & Pitfalls
If the left gap looks wrong or missing, check these first.
physical
Always the physical left
In RTL, margin-left still means left — not the start of the text. Use margin-inline-start for direction-aware spacing.
overconstrained
Width + both margins can ignore left
MDN: when width, padding, border, and both horizontal margins are all fixed, margin-left may be treated as if it were auto.
percent
% is based on width
Percentage margins resolve against the containing block’s inline size (width in horizontal writing modes).
vs
margin-left vs padding-left
Use padding-left for inner space (backgrounds extend into padding). Use margin for space between separate boxes.
collapse
Horizontal margins do not collapse
Unlike top/bottom, left and right margins between siblings do not merge into one gap.
Compatibility
Browser Support
margin-left is a browser CSS property for the box model. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
margin-left
Length, percentage, and auto values work in all modern browsers and older engines.
99%Browser support
Google ChromeAll modern versions
Full support
Mozilla FirefoxAll modern versions
Full support
Apple SafariAll modern versions
Full support
Microsoft EdgeAll modern versions
Full support
OperaAll modern versions
Full support
Samsung InternetSupported
Full support
Internet ExplorerSupported
Full support
margin-leftWidely supported
Bottom line: Safe for everyday left spacing. Remember RTL vs logical properties. It is not a runtime API.
Remember
Key Takeaways
Role: outer space on an element’s physical left edge.
Initial:0. Not inherited.
Percentages use containing-block width.
auto can push right or help center with margin-right: auto.
One line:margin-left adds outer space on the left — outside the border, before the content edge.
Frequently Asked Questions
It sets the outer space on the left of an element, outside its border. A positive value pushes the element away from content on its left; a negative value pulls it closer.
The initial value is 0. There is no left margin until you set one.
margin-left is outside the border, between elements. padding-left is inside the border, between the border and the content.
margin-left always targets the physical left edge. margin-inline-start follows writing mode and direction, so it maps to the right in RTL.
It absorbs leftover horizontal space. Alone on a block it can push the box to the right; with margin-right: auto it centers a block that has a defined width.
It is Baseline Widely available. It is a browser CSS box-model property, not a Node.js runtime feature.