Skip to content
Tutorials Center
My learning

Topics

HTML Reference ยท Inline Text

The <bdo> element

Reference for the HTML <bdo> element: forcing a text direction with the required dir attribute, when to use it, and how it differs from <bdi>.

The <bdo> element (bidirectional override) forces the text inside it to be laid out in one direction, ignoring the direction the characters would normally have. You choose the direction with the required dir attribute: ltr (left to right) or rtl (right to left).

It is rarely needed. Most of the time the Unicode bidirectional algorithm displays mixed-direction text correctly, and <bdi> or dir handles the rest. <bdo> is for the cases where you need to show characters in an exact visual order, for example when explaining how bidirectional text works or displaying data that was stored in visual order.

HTML
<bdo dir="rtl">Hello</bdo>

Try it

Overriding the direction

With dir="rtl", the letters of "stressed" are laid out from right to left, so the word reads "desserts". The last line shows the opposite: Hebrew letters forced into left-to-right order.

Attributes

Attribute Values Description
dir ltr, rtl Required. The direction to force. auto is not allowed on <bdo>.

The element also accepts the other global attributes.

Usage notes

  • The characters don't change, only their display order. Copying the text or reading it with a screen reader still gives the original logical order.
  • Not for setting a paragraph's direction. To mark a block as right-to-left, put dir="rtl" on that element. <bdo> is a stronger tool that reverses even left-to-right letters.
  • <bdo> vs <bdi>. Use <bdi> to isolate text of unknown direction. Use <bdo> only to override the direction on purpose.

Technical summary

Content categories Flow content, phrasing content, palpable content
Permitted content Phrasing content
Tag omission None; both the start and end tags are required
Permitted parents Any element that accepts phrasing content
Implicit ARIA role generic
DOM interface HTMLElement
Default display inline (with unicode-bidi: isolate-override)

Browser support

Supported in every browser.