BDO HTML

HTML <bdo> Tag

The BiDirectional Override is what the HTML <bdo> tag stands for. As the name itself suggests, it overrides the current or the default text direction, thus setting the direction of content within it. On the browser, the content then renders from left to right or right to left. For languages like Arabic or Hebrew, which are written from right to left, it is very useful.

Syntax:

<bdo dir=" ">content</bdo>

Example:

<!DOCTYPE html>
<html>
<body>
<p>HELLO WORLD!!</p>  
<p><bdo dir="rtl">HELLO WORLD!!</bdo></p>  
<p><bdo dir="ltr">HELLO WORLD!!</bdo></p>  
</body>
</html>

Explanation:

In the above example, the first paragraph is with the default text directionality. For the next two paragraphs, the HTML <bdo> tag sets the direction of content within it, which is right to left in the second paragraph and left to right in the third paragraph.

Tag-specific attributes:

Attribute Value Uses
dir ltr To specify the directionality from left to right.
dir rtl To specify the directionality from right to left.

Global Attributes:

All the HTML Global Attributes are supported by the HTML <bdo> tag.

Event Attributes:

All the HTML Event Attributes are supported by the HTML <bdo> tag.

Supporting Browsers:

Chrome, IE, Firefox, Opera, and Safari.