Isolates text with unknown direction. Learn more →
<bdo> ElementThe bidirectional text override element explicitly overrides the current text direction, forcing text to render in a specified direction (left-to-right or right-to-left).
<bdo dir="ltr">text</bdo><bdo dir="rtl">text</bdo>The dir attribute is required and must be either ltr (left-to-right) or rtl (right-to-left).
| Attribute | Description | Values |
|---|---|---|
dir | Text direction | ltr (left-to-right), rtl (right-to-left) |
<bdo> vs <bdi><!-- Explicit direction override --><p>Display <bdo dir="rtl">this text</bdo> right-to-left</p>Use when you know the direction and want to force it.
<!-- Isolate unknown direction text --><p>Username: <bdi>أحمد</bdi> logged in</p>Use when direction is unknown (user-generated content).
<bdo> vs dir Attribute<!-- Override specific span of text --><p>English <bdo dir="rtl">RTL text</bdo> English</p>Affects only the wrapped content.
<!-- Set direction for entire element --><p dir="rtl">This entire paragraph is RTL</p>Affects the entire element and its children.
Screen readers respect the dir attribute and will read the text in the specified direction.
Always combine <bdo> with the lang attribute for proper accessibility:
<p>Arabic: <bdo dir="rtl" lang="ar">مرحبا</bdo></p><p>Hebrew: <bdo dir="rtl" lang="he">שלום</bdo></p>Only use <bdo> when you need to override the default direction. For most RTL content, the dir attribute on the container is sufficient:
<p><bdo dir="rtl">كل هذا النص بالعربية</bdo></p><p dir="rtl" lang="ar">كل هذا النص بالعربية</p>| Browser | Version | Notes |
|---|---|---|
| Chrome | 1+ | Full support |
| Firefox | 1+ | Full support |
| Safari | 1+ | Full support |
| Edge | 12+ | Full support |
| IE | 5+ | Full support |
The <bdo> element has excellent browser support across all modern and legacy browsers.
Isolates text with unknown direction. Learn more →
dir attribute
Global attribute to set text direction. Learn more →