HTML Tutorial
The <bdo> tag (Bidirectional Override) allows you to override the directionality of text, ensuring it is displayed correctly regardless of the surrounding text direction.
<bdo>Use <bdo> when you have text that has a different directionality than the rest of the page, such as:
<bdo>| Attribute | Description |
|---|---|
dir |
Specifies the directionality of the text |
lang |
Specifies the language of the text |
<bdo>RTL text in an LTR context:
<p>This is an LTR paragraph.</p>
<bdo dir="rtl">This is an RTL text.</bdo>
LTR text in an RTL context:
<p dir="rtl">هذا نص من اليمين إلى اليسار.</p>
<bdo dir="ltr">This is an LTR text.</bdo>
Exploring the <bdo> Tag
<!DOCTYPE html>
<html>
<head>
<title>Exploring the <bdo> Tag</title>
</head>
<body>
<p>This is an LTR paragraph.</p>
<bdo dir="rtl">This is an RTL text.</bdo>
</body>
</html>
In this example, the <bdo> tag overrides the directionality of the RTL text, ensuring it is displayed correctly in the LTR paragraph.