The bdo tag in HTML is used to set the direction of text. The term bdo is the short-form for Bi-Directional Override. Following is the attribute−
- dir: Set the text direction. The value can be ltr or rtl for left-to-right or right-to-left directions respectively.
Let us now see an example to implement the bdo tag in HTML−
Example
<!DOCTYPE html> <html> <body> <h2>Demo Heading</h2> <p>This is a demo text!</p> <p><bdo dir="rtl">This is another demo text.</bdo></p> </body> </html>
Output
In the above example, we have set a normal text first−
<p>This is a demo text!</p>
After that, we have set a text that has a direction from rtl i.e. right-to-left using the <bdo> element −
<p><bdo dir="rtl">This is another demo text.</bdo></p>