Open In App

HTML bdo Tag

Last Updated : 11 Jul, 2025
Comments
Improve
Suggest changes
6 Likes
Like
Report

The <bdo> (Bidirectional Override) tag in HTML is used to override text directionality, explicitly setting text direction to left-to-right (LTR) or right-to-left (RTL).

  • It can make text go from left to right or right to left.
  • This is helpful for languages like Arabic or Hebrew.
  • It ensures text displays correctly in different languages.

Syntax:

<bdo dir="ltr">This text will be displayed left-to-right.</bdo>
<bdo dir="rtl"> This text will be displayed right-to-left. </bdo>
HTML
<!DOCTYPE html>
<html>

<body>
    <bdo dir="ltr">GeeksforGeeks</bdo><br>
    <bdo dir="rtl">GeeksforGeeks</bdo>
</body>

</html>

Output:

GeeksforGeeks
GeeksforGeeks
  • The <bdo> tag with dir="ltr" forces the text "GeeksforGeeks" to display from left to right, ensuring proper alignment in left-to-right contexts.
  • The <bdo> tag with dir="rtl" forces the same text to display from right to left, which is useful for languages like Arabic or Hebrew.

Attributes:

This element contains dir attributes which are used to specify the direction of text written inside the <bdo> element. The dir attribute contains two values which are listed below: 

  • rtl: Text direction is from right to left (reverses the text).
  • ltr: Text direction is from left to right (default text direction).

More Examples of the <q> Tag

Reversing Text Direction

HTML
<!DOCTYPE html>
<html lang="en">
<body>
    <p>Normal Text:</p>
    <p>This is normal text displayed in the default direction.</p>
    <p>Reversed Text:</p>
    <bdo dir="rtl">This is reversed text displayed in right-to-left direction.</bdo>
</body>
</html>
  • The <bdo> tag with dir="rtl" reverses the text direction to display it from right to left.
  • Useful for testing or correcting text direction in multilingual content.

Displaying Bi-Directional Content

HTML
<!DOCTYPE html>
<html lang="en">
<body>
    <p>Bi-Directional Content:</p>
    <p><bdo dir="rtl">This section displays text in reverse direction.</bdo></p>
    <p>Default Direction:</p>
    <p>This section remains in the default direction.</p>
</body>
</html>
  • The <bdo> tag isolates a section of text and overrides its directionality to ensure proper formatting.
  • Ideal for embedding languages like Arabic or Hebrew within a left-to-right document.

Best Practices for Using the <bdo> Tag

  • Use the <bdo> tag only when you need to override text direction explicitly.
  • Ensure the dir attribute is correctly set to either ltr or rtl for proper direction.

Explore