- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML <bdo> Tag
HTML Tags
HTML <bdo> Tag
The bdo tag forces text to run in one direction, ignoring the browser's own rules. With dir="rtl", "Hello World!" is drawn right to left and appears as "!dlroW olleH". It is a sharp tool you rarely need.
Normally the browser works out the direction of each character by itself: English left to right, Arabic and Hebrew right to left. <bdo> (bidirectional override) switches that off for its content. Most of the time, what you actually want is the bdi tag, which isolates text without forcing its direction.
Syntax
html
<bdo dir="rtl">Text to display in reverse direction</bdo>| Attribute | What it does |
|---|---|
| dir | Required. rtl for right to left, ltr for left to right. |
The global attributes such as class, id and title also work.
Example
html
<!DOCTYPE html>
<html>
<head>
<title>BDO Tag Example</title>
<style>
bdo {
background-color: #f0f0f0;
padding: 5px 8px;
border-radius: 5px;
font-weight: bold;
}
</style>
</head>
<body>
<h1>HTML <bdo> Tag Example</h1>
<p>Normal text direction:</p>
<p>Hello World!</p>
<p>Text direction reversed using <code><bdo dir="rtl"></code>:</p>
<p>
<bdo dir="rtl" id="reverse-text" class="highlight" style="color:#29AB87;">Hello World!</bdo>
</p>
<p>
Another example with <code>dir="ltr"</code> (default left to right):
<bdo dir="ltr" title="Left to Right Direction">HTML5 & CSS3</bdo>
</p>
</body>
</html>The first "Hello World!" reads normally. The second, inside <bdo dir="rtl">, appears as "!dlroW olleH". The last one, with dir="ltr", looks normal because left to right is already the default for English.
When would you use it?
- Showing text that is stored in reversed order, for example data from an old system.
- Demonstrating or testing how right-to-left text behaves.
- Fixing a specific display problem where automatic direction gets a mixed phrase wrong.
For whole pages or sections in Arabic or Hebrew, do not use <bdo>. Set dir="rtl" and lang on the <html> element or the section instead, and the browser handles everything correctly.
Browser Support
Chrome | Edge | Firefox | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
HTML <bdo> Tag exercises
Reverse the direction
Write Hello in a paragraph and force its letters to run from right to left.
Result
