Skip to content
AITroveRead. Build. Understand.
Make this comfortable

CSS logical properties: space content by reading direction

Last updated: 5 Oct 20265 min read
tutorial
BeginnerBy AITrove Editorial

Logical properties express sides and dimensions relative to the writing mode. Inline-start is the start of a line, which is not always the physical left side.

How the rule works

A bilingual case record has a small status badge next to its heading. Margin-inline-start keeps the gap on the correct side as the direction changes, while padding-block controls vertical space independently. The markup must still declare the content language and direction accurately; CSS cannot infer a person's script. If a layout truly depends on a physical device edge, a physical property may be correct, but choose that deliberately. Review icons and arrows too, since changing spacing alone does not make a directional symbol correct.

css
.case-heading { padding-block: .75rem; padding-inline: 1rem; }
.case-heading__badge { margin-inline-start: .5rem; }
.case-record { max-inline-size: 70rem; margin-inline: auto; }

Cost and verification

Logical properties add no dependency and little runtime cost. Their value is lower duplication across left-to-right and right-to-left variants. Test actual localized copy and bidirectional identifiers, not merely a mirrored screenshot. Some third-party components may still use physical margins; inspect those overrides before adding a second direction-specific rule. Keep focus and reading order aligned with the DOM in both directions.

Common Mistakes

  • Do not assume inline-start always means left.
  • Do not substitute CSS direction for correct HTML language metadata.
  • Do not mirror numbers or brand marks without reviewing their meaning.

Connected lessons

Related behavior

css
responsive
web
Storage details