Why Logical Properties: Internationalization
Understand why physical CSS properties break RTL layouts and how logical properties fix this.
Why Logical Properties: Internationalization is a free CSS Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CSS Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Problem with Physical Properties
Traditional CSS uses physical directions: top, right, bottom, left. These are fine for left-to-right (LTR) languages like English, but break for right-to-left (RTL) languages like Arabic and Hebrew, or vertical writing systems like traditional Japanese.
Physical vs Logical
Compare:
- Physical: top, right, bottom, left — fixed to the screen
- Logical: block-start, block-end, inline-start, inline-end — relative to writing mode
Block and Inline Axes
Every writing system has:
- Block axis: direction text blocks stack (vertical in LTR/RTL, horizontal in vertical writing)
- Inline axis: direction text flows within a line (horizontal in LTR/RTL, vertical in vertical writing)
LTR vs RTL Layout
In LTR (English): inline-start = left, inline-end = right. In RTL (Arabic): inline-start = right, inline-end = left. Logical properties automatically adapt without media queries or JavaScript.
Real Cost of Physical Properties
A site written with physical properties needs a separate RTL override stylesheet or per-property overrides for every margin, padding, border, position, and text-alignment property that should flip. This doubles maintenance work.
Writing Mode Affects Axes
When writing-mode: vertical-rl is set (vertical Japanese/Korean), the block axis becomes horizontal and the inline axis becomes vertical. Logical properties adapt automatically.
.vertical-text {
writing-mode: vertical-rl;
margin-block: 16px; /* now margins are left/right */
padding-inline: 8px; /* now padding is top/bottom */
}Adoption in Modern CSS
All major browsers support logical properties. The CSS specification now recommends using logical properties for any property that relates to a direction that could change with writing mode or direction.
Practical Impact
A single codebase using logical properties correctly supports LTR, RTL, and vertical writing without duplication. The CSS simply follows the direction and writing-mode values on the root element.
dir="rtl" in HTML
Set the writing direction in HTML, not just CSS:
<html lang="ar" dir="rtl">
<body>
<!-- Logical properties adapt automatically -->
</body>
</html>Progressive Adoption
You do not need to rewrite all your CSS at once. Start using logical properties for new components. Over time, refactor physical properties in components that are part of internationalization-sensitive areas.
CSS direction Property
The direction CSS property (ltr or rtl) affects inline flow direction. It works alongside writing-mode to define the complete writing system context for the element.
Quick Check
Why do physical CSS properties like margin-left cause problems in RTL layouts?
Recap
CSS logical properties use the block/inline model instead of physical top/right/bottom/left. This enables a single stylesheet to work for LTR, RTL, and vertical writing systems. The direction and writing-mode properties define the context that logical properties adapt to automatically.
Frequently asked questions
Is the “Why Logical Properties: Internationalization” lesson free?
Yes — the full text of “Why Logical Properties: Internationalization” is free to read here on the web, and the CSS Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CSS Academy course, upgrade to CoddyKit PRO.
What will I learn in “Why Logical Properties: Internationalization”?
Understand why physical CSS properties break RTL layouts and how logical properties fix this. You practise CSS Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start CSS Academy?
No prior experience is required. CSS Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Why Logical Properties: Internationalization” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this CSS Academy lesson?
Yes. Every CSS Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Why Logical Properties: Internationalization
- Block and Inline Directions
- Logical Margin Padding and Border
- Logical Properties in RTL Layouts