0Pricing
HTML Academy · Lesson

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

  1. The lang Attribute and Screen Readers
  2. dir=rtl for Right-to-Left Text
  3. The bdi and bdo Elements
  4. charset and Unicode Handling Special Characters
← Back to HTML Academy