bdi – isolated text direction
<bdi>…</bdi>
Isolates text whose writing direction you do not know in advance – typically a user name, a product name or a comment inserted into the page. An Arabic or Hebrew name then does not reorder the surrounding words and numbers.
- Default display:
display: inline - End tag: required
- Content: phrasing content
- Where it can be used: anywhere phrasing content is allowed
- DOM interface:
HTMLElement
Attributes
Only global attributes; on bdi, dir defaults to auto (the direction according to the first strong character of the text).
Examples
An Arabic user name in a ranking – without bdi the number of points moves in front of the name:
<ul> <li><bdi>Jane</bdi>: 12 points</li> <li><bdi>إيان</bdi>: 9 points</li> <li><span>إيان</span>: 9 points (without bdi)</li> </ul>
Things to watch out for
- Any element with
dir="auto"behaves the same way.bdiis useful where you do not need another element. - A forced opposite direction (mirrored text) is
bdo, notbdi.
Browser support
Baseline – widely available: in all major browsers since January 2020, considered widely available since July 2022. Since version: Chrome 16, Firefox 10, Safari 6. As of October 2026 (MDN browser-compat-data).
Related:
bdo – forced text direction
dir – text direction (attribute)
span – generic inline element