CSS margin-inline Property
Description
The margin-inline property controls the amount of outer spacing on the inline axis of a box — that is, the space before and after the box in the direction text flows. It operates at the logical-axis level rather than naming physical sides, so it sets both inline-start and inline-end margins together as a paired logical shorthand for margin-inline-start and margin-inline-end. Using this logical shorthand makes it easy to express "start" and "end" inline spacing in a single declaration without caring about which physical edges those correspond to.
Because the inline axis maps onto different physical edges depending on the page’s orientation and text direction, the actual sides affected by margin-inline depend on layout-related properties such as writing-mode and direction. In practice that means a single margin-inline rule will adapt automatically when you switch between left‑to‑right and right‑to‑left text or between horizontal and vertical writing modes. It also participates in normal cascading and specificity rules and interacts with the traditional physical shorthand — for example, declarations from the margin shorthand or explicit physical margin properties can override or be overridden according to the cascade and source order.
Authors commonly prefer margin-inline when writing components that must be direction‑ and writing‑mode‑agnostic, because it reduces the need for separate rules for LTR/RTL or vertical layouts. It composes naturally with other inline-axis logical properties such as padding-inline and inset-inline to control spacing and positioning along the same axis. Note also that inline-axis margins affect inline spacing and line-wrapping behavior rather than block-axis margin-collapsing behavior, so their layout effects and interactions differ from block-axis margins.
Definition
- Initial value
- See individual properties
- Applies to
- same as margin
- Inherited
- no
- Computed value
- See individual properties
- Animatable
- See individual properties
- JavaScript syntax
- object.style.marginInline
Interactive Demo
Syntax
margin-inline: <margin-top> {1,2}
Values
- <margin-top> {1,2}Specifies margin-block in px, pt, cm, etc. Negative values are allowed.
Example
Browser Support
The following information will show you the current browser support for the CSS margin-inline property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
