No Login Data Private Local Save

Logical Properties Playground - Online RTL & Writing Mode

7
0
0
0
📝 Writing Mode
↔️ Direction
Live Preview
block-start
inline-end
block-end
inline-start
Hello World
Preview Content
🔍 The colored labels show logical property names at their current physical positions
Logical → Physical Mapping
Logical Property Maps To Example
block-start top margin-block-startmargin-top
inline-end right padding-inline-endpadding-right
block-end bottom border-block-endborder-bottom
inline-start left margin-inline-startmargin-left
inline-size width inline-sizewidth
block-size height block-sizeheight
Adjust Logical Properties
Generated CSS

          
Frequently Asked Questions

CSS Logical Properties are a set of CSS properties that define layout, sizing, spacing, and borders based on the writing mode and text direction rather than physical directions (top, right, bottom, left). They use terms like block-start, inline-end, block-size, and inline-size. This allows layouts to automatically adapt when switching between LTR/RTL languages or vertical writing modes (like Japanese or Mongolian), without rewriting CSS rules.

Using logical properties makes your CSS direction-agnostic and writing-mode-aware. The key benefits include: (1) Automatic RTL support—your layout flips correctly for Arabic, Hebrew, Persian, and Urdu without extra overrides. (2) Vertical writing mode compatibility for East Asian languages. (3) Cleaner, more maintainable code—no need for [dir="rtl"] overrides scattered throughout your stylesheets. (4) Future-proofing—the web is increasingly multilingual, and logical properties are the modern standard for internationalized layouts.

Most physical properties have logical counterparts:
Margin/Padding: margin-block-start, padding-inline-end, etc.
Border: border-block-start-width, border-inline-start-color, etc.
Sizing: inline-size (replaces width), block-size (replaces height), min-inline-size, max-block-size.
Positioning: inset-block-start, inset-inline-end (replace top/right/bottom/left).
Overflow: overflow-inline, overflow-block.
Text alignment: text-align: start / text-align: end.

The writing-mode property defines the block axis and inline axis directions. In horizontal-tb (default), the block axis runs top-to-bottom and the inline axis runs left-to-right. In vertical-rl, the block axis runs right-to-left and the inline axis runs top-to-bottom. Logical properties reference these axes, so margin-block-start affects the top in horizontal-tb but the right side in vertical-rl. Use the playground above to switch modes and see the mapping update in real time!

direction only flips the inline axis (left ↔ right), swapping inline-start and inline-end. It does NOT affect the block axis. writing-mode fundamentally changes both axes—rotating the entire flow by 90°. In vertical-rl, the block axis becomes horizontal (right-to-left) and the inline axis becomes vertical (top-to-bottom). They can be combined: a vertical-rl writing mode with direction: rtl further flips the inline direction.

Yes! As of 2024, CSS Logical Properties enjoy excellent browser support across all modern browsers including Chrome (69+), Firefox (41+), Safari (15+), and Edge (79+). They cover over 96% of global users. Some older properties like inset-* and overflow-* logical variants have slightly later support (Safari 15+), but core margin/padding/border/size logical properties are universally supported. You can safely use them in production, potentially with physical-property fallbacks for very old browsers.

Yes, you can mix them, but be careful with specificity conflicts. If you set both margin-left and margin-inline-start on the same element, the one declared later in the cascade wins (just like any CSS property). A good practice is to use logical properties as your primary styling and only fall back to physical properties for very specific overrides or legacy browser support. For clean, maintainable code, consider adopting logical properties as your default approach for all spacing and sizing.