dir=rtl for Right-to-Left Text
Enable RTL layout for Arabic, Hebrew, and other RTL languages.
What dir Does
The dir attribute declares the base text direction of an element. dir="ltr" (left-to-right, the default for most languages) or dir="rtl" (right-to-left, for Arabic, Hebrew, Persian, Urdu).
Set on html for Whole-Site RTL
For Arabic, Hebrew, Persian and Urdu sites, set dir="rtl" on the root element. This flips the default flow of every block: text aligns right, lists indent right, scrollbars move left, and layouts auto-mirror under modern CSS.
<html lang="ar" dir="rtl">
<head>...</head>
<body>...</body>
</html>All lessons in this course
- The lang Attribute and Screen Readers
- dir=rtl for Right-to-Left Text
- The bdi and bdo Elements
- charset and Unicode Handling Special Characters