CSS “margin-inline” Property

Prathap
2 min readNov 5, 2023

--

Definition and Usage

The margin-inline property specifies the margin at the start and end in the inline direction, and is a shorthand property for the following properties:

  • margin-inline-start
  • margin-inline-end

Values for the margin-inline property can be set in different ways:

If the margin-inline property has two values:

  • margin-inline: 10px 50px;
  • margin at start is 10px
  • margin at end is 50px

If the margin-inline property has one value:

  • margin-inline: 10px;
  • margin at start and end is 10px

The CSS margin-inline and margin-block properties are very similar to CSS properties margin-top, margin-bottom, margin-left and margin-right, but the margin-inline and margin-block properties are dependent on block and inline directions.

Note: The related CSS properties writing-mode and direction define inline direction. This affects where the start and end of an element is and the result of the margin-inline property. For pages in English, block direction is downward and inline direction is left to right.

--

--

No responses yet