Frontend Development 9 min read

Master CSS Logical Properties for Seamless RTL Support

Modern CSS logical properties let developers write direction‑agnostic styles, replacing left/right and top/bottom values with start/end and block/inline equivalents, thereby simplifying RTL support, reducing duplicated code, and improving maintainability across browsers in modern web projects.

KooFE Frontend Team
KooFE Frontend Team
KooFE Frontend Team
Master CSS Logical Properties for Seamless RTL Support
This article is translated from Aleksandr Hovhannisyan’s “Writing Better CSS”. Click “Read original” at the end for the source.

In early web development, layouts relied on tables and hacks; modern CSS now enables clean, responsive designs across browsers, reducing code bloat.

Using Logical Properties for RTL Support

If your app is monolingual, you can safely use physical properties like

margin-left

,

padding-right

, and absolute positioning. However, for internationalized apps supporting RTL languages (Arabic, Hebrew), you must consider directionality.

Traditional RTL approach: write LTR CSS then scope RTL styles with the

dir

attribute, using physical properties (top, right, bottom, left). Example:

<code>.element {
  /* LTR CSS */
  margin-left: 8px;
}
html[dir="rtl"] .element {
  /* RTL CSS */
  margin-left: unset;
  margin-right: 8px;
}
</code>

Maintaining separate LTR and RTL rules leads to duplicated code. Logical properties simplify this by using start/end instead of left/right.

<code>.element {
  margin-inline-start: 8px;
}
</code>

Logical properties consist of three parts: the property name (e.g.,

margin

), the flow direction (

block

or

inline

), and the start/end side, plus related sub‑properties such as

color

or

width

. For example,

border-left-color

maps to

border-inline-start-color

. In LTR,

start

equals

left

; in RTL, it equals

right

, allowing a single rule to work for both.

Logical properties are my favorite recent CSS feature; they work even without RTL support and make future internationalization easy.

Logical Property Examples

Common logical properties and their physical equivalents:

[margin|padding|border]-left

[margin|padding|border]-inline-start
[margin|padding|border]-right

[margin|padding|border]-inline-end
[margin|padding|border]-top

[margin|padding|border]-block-start
[margin|padding|border]-bottom

[margin|padding|border]-block-end
border-bottom-width

border-block-end-width
border-left-color

border-inline-start-color

Using logical properties reduces duplication compared to maintaining separate LTR and RTL styles.

Positioning

Absolute, relative, and fixed positioning can also use logical properties:

top

inset-block-start
bottom

inset-block-end
left

inset-inline-start
right

inset-inline-end

Width & Height

For vertical writing modes, use:

width

inline-size
height

block-size

Width is symmetric and unaffected by RTL.

Logical Property Values

Some property values also have logical equivalents:

text-align: right;

text-align: end;
justify-content: left;

justify-content: start;
float: left;

float: inline-start;
float: right;

float: inline-end;

Browser Support

Browser support chart
Browser support chart

This article focuses on using CSS logical properties to support different writing modes, making CSS code cleaner. It is the third part of a series; previous parts can be read via the links below.

Writing Better CSS (Part I)

Writing Better CSS (Part II)

frontendweb developmentcssRTLLogical Properties
KooFE Frontend Team
Written by

KooFE Frontend Team

Follow the latest frontend updates

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.