CSS Logical Properties Reference

CSS logical vs physical property mapping for block/inline axis with writing-mode.

Reference mapping CSS logical properties (margin-inline-start, inset-block-end, etc.) to their physical equivalents, with a writing-mode resolver that shows which physical side each logical side becomes. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What are the block and inline axes?

The block axis is the direction text blocks stack, and the inline axis is the direction text runs within a line. In default horizontal English, block is top-to-bottom and inline is left-to-right, but writing-mode and direction can rotate or reverse them.

Write layout that flows, not that hard-codes sides

CSS logical properties describe boxes by their relationship to the text flow — block and inline axes, start and end edges — instead of fixed top, right, bottom, left. This lets one stylesheet adapt to right-to-left and vertical writing modes automatically. This reference maps each logical property to its physical equivalent and resolves which physical side it becomes for any writing mode.

How it works

Two axes replace the four physical sides. The inline axis follows the direction text runs; the block axis follows the direction lines stack. Each has a start and an end:

/* physical, breaks in RTL */
margin-left: 1rem;

/* logical, flips automatically */
margin-inline-start: 1rem;

The resolution depends on writing-mode and direction. In horizontal-tb + ltr, inline-start = left and block-start = top. Switch to direction: rtl and inline-start becomes right. Switch to writing-mode: vertical-rl and block-start becomes the right edge while inline-start becomes the top.

Axis resolution table

writing-modedirectionblock-startblock-endinline-startinline-end
horizontal-tbltrtopbottomleftright
horizontal-tbrtltopbottomrightleft
vertical-rlltrrightlefttopbottom
vertical-lrltrleftrighttopbottom

Common physical-to-logical conversions

Physical propertyLogical equivalent
margin-topmargin-block-start
margin-leftmargin-inline-start
padding-rightpadding-inline-end
border-bottomborder-block-end
top, left (positioned)inset-block-start, inset-inline-start
widthinline-size
heightblock-size
max-widthmax-inline-size

The shorthands collapse two edges: margin-inline: auto centres the element horizontally in ltr and rtl equally, replacing the common margin-left: auto; margin-right: auto pattern.

Practical migration tips

Start at the layout level. The highest-leverage swap is replacing margin-left and padding-left with their logical equivalents on navigation items, form labels and list indentation — these are the first things to break in an RTL layout.

Use inset for positioned elements. The inset shorthand is the logical equivalent of setting all four edges at once. inset: 0 replaces top: 0; right: 0; bottom: 0; left: 0. Use inset-inline-start and inset-block-start to position relative to the text flow rather than the screen.

text-align: start replaces text-align: left — it aligns to wherever the line begins regardless of direction.

Tips and notes

  • Use the *-inline / *-block shorthands (margin-inline: 1rem) for both edges at once.
  • inset-inline-start / inset-block-end replace left/bottom for positioned boxes.
  • Logical properties remove most [dir="rtl"] overrides from your stylesheet.
  • text-align: start and float: inline-end are the logical equivalents of left/right.
  • Mixing logical and physical on the same side leads to cascade surprises — pick one system per component.