Most teams add Arabic at the end. The English interface ships, then someone is asked to "support Arabic", and a week later the layout looks like a mirrored photograph of the original. Buttons sit on the wrong side, numbers point backwards in mixed sentences, and every new component reopens the same argument.
There is a cheaper order: decide the direction at the root, use CSS properties that do not know left from right, and let the browser do the mirroring. This is how I build Arabic-first interfaces, including my Etamen app (https://ashraf-alrashidi.github.io/etamen/).
Set the direction once, on the root element
<html lang="ar" dir="rtl"> That single attribute flips the inline base direction of the whole document. Everything that follows from it, including text alignment, list markers, table column order and the default direction of scrollbars, comes for free. Do not set dir on individual blocks to fix local problems; if a block looks wrong, the layout is fighting the root instead of using it.
For user-generated text, let the browser decide:
<p dir="auto">...</p> dir="auto" picks the direction from the first strong character, which is exactly what you want for names, comments and search results.
Stop writing left and right
The single biggest source of RTL debt is physical CSS: margin-left, padding-right, left, border-right. Each one has to be duplicated for the other direction, and every duplicate is a place to forget.
Logical properties replace them with start and end, which follow the writing direction:
.card { margin-inline-start: 16px; /* left in LTR, right in RTL */ padding-inline-end: 24px; border-inline-start: 3px solid #444; text-align: start; } The same idea exists for positioning and sizing: inset-inline-start, inline-size, block-size. If a stylesheet has no physical left/right in it, RTL support is mostly done.
Floats and flexbox
Flexbox already respects direction: flex-direction: row lays items out along the inline axis, so it mirrors itself. Avoid row-reverse as an RTL fix, because it flips a layout that is already correct and produces LTR bugs in the RTL build. Floats are the opposite problem: float: left is physical, so replace floats with flex or grid wherever possible.
Numbers, dates and mixed sentences
Arabic content routinely mixes Arabic words, Latin product names and digits, and that is where bidi gets ugly. Three rules cover most of it:
new Intl.NumberFormat('ar-EG').format(1234.5) // locale-correct digits and separators new Intl.DateTimeFormat('ar-EG', { dateStyle: 'long' }).format(new Date()) Use Intl instead of hand-formatting, and wrap a Latin fragment inside Arabic text in <bdi> so it cannot drag neighbouring punctuation to the wrong end of the line. Inside an RTL form, phone numbers, emails and URLs should be explicitly dir="ltr", because the user types them left to right even when the label is Arabic.
Typography is part of the layout
Arabic script needs more vertical room than Latin at the same font size: taller ascenders and descenders, and diacritics above and below. A line-height tuned for Latin looks cramped in Arabic. Set the line-height for the Arabic stack, and use a font that was designed for it rather than a Latin font with Arabic glyphs bolted on. Arabic web fonts such as Cairo, Tajawal and IBM Plex Sans Arabic are all available from Google Fonts and load with font-display: swap.
Icons and chevrons
Directional icons must mirror; non-directional icons must not. A back arrow, a chevron pointing to the next page, and a progress arrow all flip. A clock, a camera and a user silhouette do not. The cheap fix is a class applied only to the directional ones:
[dir="rtl"] .icon-directional { transform: scaleX(-1); } Test with Arabic content, not with lorem ipsum
The failure mode of RTL work is testing with English text in a flipped layout. It looks fine and proves nothing. Put real Arabic sentences in the design, with a Latin brand name and a number inside the same paragraph, and check the result at the narrowest breakpoint. That is where the wrapping and the bidi edge cases appear.
What this buys
Doing it this way means Arabic is not a separate build. There is one stylesheet, one component set, and a direction attribute at the root. New features are Arabic-capable the day they are written, and nobody has to maintain a mirrored copy of the CSS.
I am Ashraf Alrashidi (اشرف الرشيدي), a Computer Science student in Egypt building Arabic-first web apps and Flutter apps for Google Play. Etamen, my Arabic-first web app, is live at https://ashraf-alrashidi.github.io/etamen/.
Links: Portfolio https://ashraf-alrashidi.github.io/ - GitHub https://github.com/Ashraf-AlRashidi - dev.to https://dev.to/ashraf-alrashidi
This article was written with AI assistance and reviewed by Ashraf Alrashidi.