Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Logical CSS properties

A conversion table from physical CSS properties (left, right, margin-left, text-align: left) to logical ones (inline-start, inline-end), what has no logical form, and how to convert an existing stylesheet safely.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/designers/theme-design/logical-css-properties.md

On this page

Logical CSS properties

This page is a reference for designers writing CSS that works in both text directions. Logical properties name sides by the flow of text (start and end) instead of the screen (left and right).

Contents

  1. Conversion table
  2. What has no logical form
  3. Converting a stylesheet

Conversion table

PhysicalLogical
margin-left / margin-rightmargin-inline-start / margin-inline-end
margin-left + margin-rightmargin-inline
padding-left / padding-rightpadding-inline-start / padding-inline-end
left / right (positioned)inset-inline-start / inset-inline-end
top / bottominset-block-start / inset-block-end
border-left / border-rightborder-inline-start / border-inline-end
border-top-left-radiusborder-start-start-radius
border-top-right-radiusborder-start-end-radius
border-bottom-left-radiusborder-end-start-radius
border-bottom-right-radiusborder-end-end-radius
text-align: left / righttext-align: start / end
width / heightinline-size / block-size (optional; only matters for vertical writing)

Left to right, each logical property computes to the same value as the physical one, so converting changes nothing for left-to-right pages. This is how the administration's stylesheets were converted (components.css, admin4.css, pagelayout.css, core.css and the module stylesheets).

What has no logical form

PropertyWhat to do
float: left / rightfloat: inline-start / inline-end where supported, or a :where([dir="rtl"]) mirror rule
four-value margin/padding with different left and rightsplit into margin-block and margin-inline, or add a mirror rule
background-position: left ...a mirror rule
box-shadow / text-shadow with a horizontal offseta mirror rule
transform: translateX()a mirror rule (negate the value)
grid and flexnothing: they follow the direction already

A mirror rule follows the rule it mirrors:

.teaser { background-position: left center; }
:where([dir="rtl"]) .teaser { background-position: right center; }

Converting a stylesheet

  1. Search for left and right: grep -n -E "left|right" stylesheets/*.css.
  2. Convert each into its logical form from the table; leave alignment chosen by editors (.text-left classes from rich text) alone.
  3. Add mirror rules for what has no logical form.
  4. Compare screenshots of left-to-right pages before and after: they must be identical.
  5. Check a right-to-left page.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x