In horizontal left-to-right layout that maps to left and right. With direction: rtl or a vertical writing-mode, the physical sides update automatically. The property is not inherited.
Baseline · Widely available.
Not deprecated. Broad support since about 2021. Prefer it over margin-left / margin-right when direction can change.
Syntax
CSS Syntax
syntax.css
margin-inline:<start><end>? | auto | inherit;
One value sets both sides. Two values set start then end: margin-inline: 1rem 2rem;.
Set margin-inline: auto. Free space splits on both inline sides.
Modern centering. Same idea as classic margin-left/right: auto.
Still logical. Works with direction changes without rewriting left/right.
Edge Cases & Pitfalls
If sides look swapped or centering fails, check these first.
logical
Not the same as left/right forever
Mapping depends on writing-mode and direction. In vertical modes, inline margins can land on top/bottom.
order
Two values are start, then end
margin-inline: 8px 24px is not “left then right” in every language — it is inline-start then inline-end.
auto
auto needs leftover space
Centering with margin-inline: auto needs a width (or max-width) smaller than the container and a block that can take auto margins.
vs
margin-inline vs padding-inline
Margin is outside the border. Use padding-inline for inner side space that keeps the background.
shorthand
Overrides both longhands
Setting margin-inline resets start and end together. Set a longhand afterward if only one side should differ.
Compatibility
Browser Support
margin-inline is a browser CSS property for logical margins. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
margin-inline
Supported in all modern browsers (broad support from about 2021). Prefer it for direction-aware side margins.
96%Modern browser support
Google Chrome87+
Full support
Mozilla Firefox66+
Full support
Apple Safari14.1+
Full support
Microsoft Edge87+
Full support
Opera73+
Full support
Samsung Internet15+
Full support
Internet ExplorerNo support
No support
margin-inlineWidely supported
Bottom line: Safe for modern sites. Fall back to margin-left/right only if you must support very old browsers. It is not a runtime API.
Remember
Key Takeaways
Shorthand for inline-start and inline-end margins.
Follows direction and writing mode — better than physical left/right for i18n.
One or two values: equal sides, or start then end.
auto centers a sized block on the inline axis.
One line: use margin-inline for side margins that stay correct when text direction changes.
Frequently Asked Questions
It is a shorthand for margin-inline-start and margin-inline-end. It sets outer spacing on the inline axis, which maps to left/right in horizontal LTR and flips with direction or writing mode.
Both longhands default to 0, so there is no inline-axis margin until you set one.
margin-left and margin-right always target physical sides. margin-inline follows writing mode and direction, so spacing stays correct in RTL and vertical layouts.
Yes. One value sets both sides. Two values set start then end, for example margin-inline: 1rem 2rem;
No. Set it on each element that needs inline-axis margins.
It is Baseline Widely available (broad support since about 2021). It is a browser CSS property, not a Node.js feature.