Set direction and language in the markup
RTL web development starts with two attributes on the html element: dir="rtl" and lang="he". This article is specific to the Israeli market, where a product usually needs a Hebrew interface and often an English one beside it.
The dir attribute sets the base direction of the document, and the browser mirrors what depends on it: text alignment, the order of flex and grid columns, table columns and list markers. The lang attribute tells screen readers which language to pronounce and lets the browser pick suitable fonts and spell checking. We set direction in the markup, not with the CSS direction property: direction is part of the content, and it has to stay correct when a stylesheet fails to load.
Write CSS with logical properties
Physical properties such as margin-left or right: 0 describe the screen. Logical properties describe the flow of the text, so one stylesheet serves both directions.
Flexbox and grid already follow the document direction. Some things do not flip on their own: translateX values, background-position, box-shadow offsets and gradient angles. Tailwind CSS ships logical utilities such as ms-4, pe-2 and text-start, plus an rtl: variant for the few cases that need a specific override. We add a lint rule that rejects physical properties, so the old habits do not return.
- margin-inline-start and padding-inline-end in place of the left and right variants.
- inset-inline-start and inset-inline-end for positioned elements, or the inset-inline shorthand.
- text-align: start and text-align: end in place of left and right.
- border-inline-start and border-start-start-radius for borders and corners.
Mirror only the icons that indicate direction
An icon is mirrored when it expresses direction or progress along the reading order. Back and forward arrows, chevrons in menus and breadcrumbs, progress bars, sliders and step indicators all flip. In Hebrew, "back" points to the right.
Icons that represent an object or a universal convention stay as they are: logos, check marks, clocks and media controls. Play, rewind and fast-forward follow the direction of the tape, not the direction of the text. We mirror with a scaleX(-1) transform under a [dir="rtl"] selector, driven by one prop on the icon component, so the decision is made once per icon and not once per screen.
Bidirectional text: Latin words and numbers inside Hebrew
Hebrew interfaces are full of left-to-right fragments: brand names, English terms, prices, dates, phone numbers and email addresses. The browser orders them with the Unicode bidirectional algorithm, which handles a Latin word in the middle of a Hebrew sentence well. It goes wrong at the edges: a sentence that starts with an English name, a number followed by punctuation, a phone number whose plus sign jumps to the wrong side.
- Wrap any inserted value of unknown direction, such as a user name or a product title, in the bdi element. It isolates the value from the text around it.
- Use dir="auto" on elements and inputs that hold user-generated content. The browser picks the direction from the first strongly directional character.
- Wrap phone numbers and codes in a span with dir="ltr", so that digits, dashes and the plus sign keep their order.
- Prefer markup to invisible Unicode control characters, which nobody can see in a code review.
Choose a real Hebrew font
Many Latin typefaces have no Hebrew glyphs. When the brand font lacks them, the browser falls back to a system font and the page mixes two unrelated designs. We choose a family designed for Hebrew and Latin together, such as Heebo, Assistant, Rubik or Noto Sans Hebrew, and load only the subsets the page needs.
Hebrew has no capital letters, so text-transform: uppercase does nothing, and a design that relies on capitals for hierarchy needs another device. Hebrew has no italic tradition either, and browsers fake one by slanting the letters, so we use weight or color for emphasis.
Forms: phone numbers, emails and codes
Some fields are left to right in every language: email addresses, URLs, phone numbers, card numbers and verification codes. We set dir="ltr" on these inputs so that the caret and the typing order behave correctly, and keep the label and the error message in Hebrew. Free-text fields such as a name or a message get dir="auto", because Israeli users type in both languages.
The usual form rules still apply: type="email" and type="tel" for the right mobile keyboard, inputmode="numeric" for codes, and autocomplete attributes. A phone field should accept both the local format and the international one with the +972 prefix. For prices and dates we use the Intl API with the he-IL locale, which formats shekel amounts and dates the way Israeli users expect, and date pickers start the week on Sunday.
Bilingual sites: hreflang and testing both directions
Hebrew website development for an Israeli company usually means a bilingual site. Each language gets its own URL, for example a /he/ path and an /en/ path, and every page lists its alternates in link elements with hreflang: he, en and x-default. The annotations must be reciprocal, and each page also lists itself. We do not redirect automatically by IP address or browser language, and the language switcher leads to the same page in the other language, not to the home page.
Both directions are tested on every change. Our end-to-end tests run the main flows in Hebrew and in English, and visual comparisons catch a mirrored logo or a clipped label.