<bdo> Tag in HTML

The <bdo> tag stands for "Bidirectional Override" and is used to override the default text direction of an element. It is particularly useful when you want to explicitly control the direction of text (left-to-right or right-to-left) within an element.

Key Points on <bdo> Tag:

Syntax of <bdo> Tag:

Syntax Example

<bdo dir="rtl">Your text here</bdo>

Example of <bdo> Tag in HTML:

This example demonstrates how the <bdo> tag is used to override the text direction.

Code Example


        <html>
            <head></head>
            <body>
                <p>Normal text, followed by a مرحبا word in right-to-left direction.</p>
            </body>
        </html>
                

Output

Normal text, followed by a مرحبا word in right-to-left direction.

The <bdo> tag is used here to specify that the word "مرحبا" should be displayed from right-to-left, even though it appears in the middle of left-to-right text. The dir="rtl" attribute forces the text direction to be right-to-left, overriding the default direction of the surrounding content.