PureDevTools

CSS Logical Properties Guide

Map physical to logical properties — toggle writing modes to see how block/inline sides adapt

All processing happens in your browser. No data is sent to any server.

Writing Mode

Horizontal, left-to-right (English, French, Spanish…)

Live Preview — borders use logical properties, colors show which side they resolve to

block-start → top
inline-start → left
Content
inline-end → right
block-end → bottom

Switch modes above to see how each logical side maps to a different physical edge.

Axis Mapping in LTR Mode

block-start
resolves to top
block-end
resolves to bottom
inline-start
resolves to left
inline-end
resolves to right

Example CSS

.element {
  writing-mode: horizontal-tb;
  direction: ltr;

  /* Logical properties — adapt to writing mode: */
  margin-block-start: 16px;      /* = margin-top: 16px */
  margin-block-end: 16px;        /* = margin-bottom: 16px */
  padding-inline-start: 24px;    /* = padding-left: 24px */
  padding-inline-end: 24px;      /* = padding-right: 24px */
  border-block-start: 2px solid; /* = border-top: 2px solid */
  inset-inline-start: 0;         /* = left: 0 */
  inline-size: 100%;             /* = width: 100% */
  block-size: auto;              /* = height: auto */
}

Your RTL layout works — until you realize every margin-left, padding-right, and border-left needs a [dir="rtl"] override. That’s 200+ properties to mirror manually, and if you miss one, the Arabic or Hebrew version of your UI has a spacing glitch that QA won’t catch until launch week. CSS logical properties eliminate the entire problem: write margin-inline-start once, and it resolves to left in LTR and right in RTL automatically.

Why This Reference (Not MDN’s 12 Separate Pages)

MDN documents each logical property on its own page — margin-inline-start, padding-block-end, inset-inline-start, inline-size — with no unified mapping table. This reference puts all 26 physical-to-logical mappings on one page with a writing mode toggle (LTR, RTL, vertical-rl, vertical-lr) so you can see how every property resolves in each context. Includes a CSS converter that generates fallbacks. Everything runs in your browser; no data is sent anywhere.

What Are CSS Logical Properties?

CSS logical properties are CSS properties that map to physical sides (top, right, bottom, left) based on the document’s writing mode and text direction — rather than being hard-coded to a specific physical edge.

Instead of writing margin-left, you write margin-inline-start. In a left-to-right (LTR) horizontal layout, inline-start maps to left. In a right-to-left (RTL) layout, the same margin-inline-start automatically maps to right. Your CSS adapts to the language without any changes.

/* Physical — hard-coded, never adapts */
.card {
  margin-left: 16px;
  padding-top: 24px;
  border-right: 1px solid;
  width: 320px;
}

/* Logical — adapts to writing mode */
.card {
  margin-inline-start: 16px;
  padding-block-start: 24px;
  border-inline-end: 1px solid;
  inline-size: 320px;
}

The Two Logical Axes

CSS logical properties replace the four physical directions (top/right/bottom/left) with two axes:

Block Axis

The block axis runs perpendicular to the flow of inline content (text). In horizontal writing modes, the block axis is vertical (top → bottom). In vertical writing modes, the block axis is horizontal.

Inline Axis

The inline axis runs along the direction of text flow. In horizontal LTR, the inline axis is left → right.

Physical to Logical: Complete Property Map

Spacing: Margin & Padding

PhysicalLogical
margin-topmargin-block-start
margin-bottommargin-block-end
margin-leftmargin-inline-start
margin-rightmargin-inline-end
padding-toppadding-block-start
padding-bottompadding-block-end
padding-leftpadding-inline-start
padding-rightpadding-inline-end

Shorthand logical properties also exist:

/* Sets block-start and block-end (like margin-top + margin-bottom) */
margin-block: 16px;

/* Sets inline-start and inline-end (like margin-left + margin-right) */
margin-inline: 24px;

/* Same for padding */
padding-block: 16px;
padding-inline: 24px;

Borders

PhysicalLogical
border-topborder-block-start
border-bottomborder-block-end
border-leftborder-inline-start
border-rightborder-inline-end

Border radius logical properties:

border-start-start-radius: 8px;  /* = border-top-left-radius in LTR */
border-start-end-radius: 8px;    /* = border-top-right-radius in LTR */
border-end-start-radius: 8px;    /* = border-bottom-left-radius in LTR */
border-end-end-radius: 8px;      /* = border-bottom-right-radius in LTR */

Positioning (Inset)

PhysicalLogical
topinset-block-start
bottominset-block-end
leftinset-inline-start
rightinset-inline-end

The inset shorthand also works logically:

/* Logical shorthand equivalents */
inset-block: 0;   /* top: 0; bottom: 0 */
inset-inline: 0;  /* left: 0; right: 0 (in LTR) */

Sizing

PhysicalLogical
widthinline-size
heightblock-size
min-widthmin-inline-size
max-widthmax-inline-size
min-heightmin-block-size
max-heightmax-block-size

Text Alignment & Float

PhysicalLogical
text-align: lefttext-align: start
text-align: righttext-align: end
float: leftfloat: inline-start
float: rightfloat: inline-end

How Writing Modes Affect the Mapping

The logical-to-physical mapping depends on two CSS properties: writing-mode and direction.

horizontal-tb + direction: ltr (Default — English)

Block axis:  top → bottom
Inline axis: left → right

block-start  = top
block-end    = bottom
inline-start = left
inline-end   = right

horizontal-tb + direction: rtl (Arabic, Hebrew)

Block axis:  top → bottom  (unchanged)
Inline axis: right → left  (flipped)

block-start  = top
block-end    = bottom
inline-start = right   ← now right
inline-end   = left    ← now left

vertical-rl (Traditional Chinese, Japanese)

Block axis:  right → left
Inline axis: top → bottom

block-start  = right   ← now right
block-end    = left    ← now left
inline-start = top
inline-end   = bottom

vertical-lr (Mongolian script)

Block axis:  left → right
Inline axis: top → bottom

block-start  = left
block-end    = right
inline-start = top
inline-end   = bottom

Practical Examples

Internationalized Navigation

A navigation layout that works for both LTR and RTL languages without duplicating styles:

.nav {
  /* Physical approach — needs overrides for RTL */
  padding-left: 16px;
  border-left: 3px solid blue;
}

/* Override needed for RTL */
[dir="rtl"] .nav {
  padding-left: 0;
  padding-right: 16px;
  border-left: none;
  border-right: 3px solid blue;
}
/* Logical approach — one rule, works everywhere */
.nav {
  padding-inline-start: 16px;
  border-inline-start: 3px solid blue;
}

Card Component

.card {
  inline-size: 320px;        /* width in horizontal modes */
  padding-block: 20px;       /* padding-top + padding-bottom */
  padding-inline: 24px;      /* padding-left + padding-right (LTR) */
  border-block-end: 1px solid currentColor; /* border-bottom in LTR */
  margin-inline: auto;       /* center horizontally (like margin: 0 auto) */
}
.sidebar {
  position: sticky;
  inset-block-start: 0;     /* top: 0 in horizontal mode */
  inset-inline-start: 0;    /* left: 0 in LTR, right: 0 in RTL */
  block-size: 100vh;        /* height: 100vh in horizontal mode */
  min-inline-size: 240px;   /* min-width in horizontal mode */
}

Tooltip Arrow (Using border-radius logical)

.tooltip {
  border-start-start-radius: 0;  /* no radius at arrow corner */
  border-start-end-radius: 6px;
  border-end-start-radius: 6px;
  border-end-end-radius: 6px;
}

When to Use Logical Properties

Use logical properties when:

Physical properties are still fine when:

Browser Support

All major logical properties have excellent browser support (95%+ global coverage as of 2025):

No vendor prefixes are needed for any logical properties in modern browsers.

Frequently Asked Questions

Do logical properties work in Flexbox and Grid? Yes. gap in Flexbox/Grid uses the block and inline axes automatically. Properties like align-items and justify-content also follow the block/inline model. You don’t need logical properties for the Flex/Grid axis properties themselves — they’re already logical by design.

Are there logical shorthand properties? Yes. margin-block sets both margin-block-start and margin-block-end in one declaration. Similarly for margin-inline, padding-block, padding-inline, border-block, border-inline, inset-block, inset-inline, and the plain inset (sets all four logical sides).

What is the difference between writing-mode and direction? writing-mode controls whether text flows horizontally or vertically and the direction of the block axis. direction controls the inline text direction (LTR or RTL) within a horizontal writing mode. For RTL languages, you typically set direction: rtl on the <html> or a container element. writing-mode is used for vertical text layouts.

Should I replace all physical properties with logical ones? Not necessarily. Migrate gradually and focus on properties where directionality matters: spacing, positioning, and borders on text-aligned sides. Properties where the visual meaning is absolute (like a border-bottom underline decoration) are fine to leave as physical.

Can I mix logical and physical properties? Yes, but avoid setting the same dimension using both systems. For example, don’t set both width and inline-size on the same element — the last declaration wins. Pick one system per property dimension.

Related Tools

More CSS Tools