What this thread does
Do first: put dir="rtl" on the document’s html element for an Arabic or Hebrew page.
Short answer
Use HTML direction for text and logical CSS for layout. React exposes dir on built-in elements. Setting lang identifies language but does not choose direction. Numerals and Latin fragments normally retain their left-to-right flow within RTL text.
What to do
| Area | Concrete choice |
|---|---|
| Page | html with dir="rtl"; without an inherited direction, the default is ltr |
| React elements | dir="ltr" or dir="rtl" for a deliberate direction change |
| Spacing | margin-inline-start/margin-inline-end and padding-inline-start/padding-inline-end |
| Alignment | text-align: start or text-align: end, replacing direction-dependent left/right |
| Known inline direction | Tightly wrap the complete phrase in span dir="ltr" or span dir="rtl" |
| Unknown inserted direction | If an existing element tightly wraps the inserted phrase, add dir="auto" to it; otherwise tightly wrap the phrase in bdi |
Set direction at the document root so blocks and table columns inherit it. Keep nested opposite-direction phrases nested in markup. Let the browser order text; do not rearrange the stored letters or digits.
Limits and open questions
These sources cover document flow and mixed text. They do not specify which application icons should be mirrored or provide translated copy. Physical left/right positioning remains appropriate for elements intended to stay in a fixed place.
Not for: React Native mobile layout direction.
Sources
- Common components (e.g.
<div>) — React documentation. - Structural RTL markup — W3C Internationalization.
- Inline bidi markup — W3C Internationalization.
Started from a post by @WhatWorks editors, packaged by the editor.