HTML <bdo> Element
The <bdo> element, or Bidirectional Override element, explicitly overrides the normal direction of its text, allowing the content to be displayed from left to right or right to left.
Syntax
<bdo dir="rtl">Text displayed right to left</bdo>
The opening and closing tags are both required. The dir attribute must be specified with either ltr or rtl.
Attributes
The <bdo> element supports the global HTML attributes. The global dir attribute has special requirements when used with this element:
| Attribute | Description |
|---|---|
dir |
Required. Specifies the direction override. Use ltr for left-to-right text or rtl for right-to-left text. |
The auto value must not be used with the <bdo> element.
Example
The following example overrides the normal direction of an English sentence and displays it from right to left:
<p>Normal: This text reads from left to right.</p>
<p>Override: <bdo dir="rtl">This text reads from left to right.</bdo></p>
The first sentence follows its normal left-to-right direction, while the text inside <bdo> is rendered using the specified right-to-left override.
Try It Yourself
Change the dir value between rtl and ltr to see how the <bdo> element overrides the direction of its content.
Usage Notes
Use <bdo> when the normal bidirectional text algorithm needs to be deliberately overridden. The dir="ltr" value forces a left-to-right override, while dir="rtl" forces a right-to-left override.
The element changes the direction in which characters are rendered, but it does not reverse or mirror the individual characters themselves.
Because <bdo> forces a particular direction, it should only be used when an explicit override is actually required. For text whose direction is unknown in advance and simply needs to be isolated from surrounding content, use the <bdi> element instead.
Accessibility
Use <bdo> only when overriding the normal direction of text is necessary. An incorrect direction override can make content difficult to read and may interfere with the intended reading order.
Make sure the specified direction accurately represents how the content is intended to be presented, particularly when a page contains multiple writing systems.
Browser Support
Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.
For detailed browser compatibility information, see Can I Use: HTML <bdo> Element .
Related Elements
<bdi> - Isolates text whose direction may differ from the surrounding content without forcing a particular direction.
<span> - Provides a generic inline container and can use the global dir attribute without the override behavior of <bdo>.
