HTML / HTML Tags

HTML <Bdo> Tag

Dec 12, 2022
2 min read
HTML bdo Tag

Definition

The <bdo> tag, or Bidirectional Text Override tag, allows you to override the bidirectional text algorithm by explicitly setting a direction.

Example

<p><bdo dir="rtl">
The direction of this text is right to left.
</bdo></p>
<p><bdo dir="ltr">
The direction of this text is left to right.
</bdo></p>
<p>The direction of this text is left to right.</p>

The direction of this text is right to left.

The direction of this text is left to right.

The direction of this text is left to right.

Usage

  • The <bdo> element takes the dir attribute , where you can specify the direction of text required.
  • The <bdo> element was introduced when support for character encoding RTL languages such as Arabic was poor. Nowadays, this is not such an issue, and as such, the <bdo> should largely be avoided. Due to the browser’s bidirectional algorithm, it is advisable to use the <bdi> element , or Bidirectional Isolate Element, instead. This isolates the text direction to avoid issues when text order issues.

Attributes

The <bdo> element supports the Global Attributes, as well as the following:

  • dir

    The dir attribute specifies the text direction of the content inside the <bdo> element. It takes the following values:

    • ltr - specifies the text should be left to right.
    • rtl - specifies the text should be right to left.

Best Practices

  • As mentioned above, it is recommended you use the <bdi> element instead.

Specification

Browser Support

Desktop

ChromeEdgeFirefoxIEOperaSafari
YesYesYesYesYesYes

Mobile

Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet
YesYesYesYesYesYes