WEB DEV ACCESSIBILITY TIP: Text Display Direction Switcheroo

Multi-colored arrows pointing right to left

The dir attribute is used to set the base direction of text for display. It is essential for enabling HTML in right-to-left scripts such as Arabic, Hebrew, Syriac, and Thaana. Numerous different languages are written with these scripts, including Arabic, Hebrew, Pashto, Persian, Sindhi, Syriac, Dhivehi, Urdu, Yiddish, etc.

The lang attribute specifies a language written right-to-left, so dir=rtl is needed to change the text layout direction.

SOLUTION: Add dir=”rtl” to the html tag any time the overall document direction is right-to-left. This sets the base direction for the whole document.


<!doctype html>
<html dir=”rtl” lang=”ar”>



WEBSITE ACCESSIBILITY TESTING & REMEDIATION SERVICES: Mary Gillen is an experienced Website Accessibility Compliance Auditor and Remediator. She can test your website to determine if it meets accessibility standards:

WCAG 2.1: 312 checkpoints covering A, AA and AAA W3 accessibility guidelines
Section 508: 15 US federal guidelines covered by 59 accessibility checkpoints

Find out more about Mary Gillen’s Accessibility Testing & Remediation Services: Websites, PDFs, Office Docs & Videos