<bdi>: The BDI Element
Last updated: 2026-10-13
<bdi>The BDI Element
Bi-directional isolation: treats its text as an isolated direction segment, avoiding mixed-direction contamination.
| Category | Text Content |
|---|---|
| Content Model | Flow content |
| Allowed Parents | Any element that accepts flow content |
| Content Tag | Yes — requires closing </bdi> tag |
| Status | Standard |
📝 Syntax
<bdi>username</bdi>
▶ Example
Edit the code below and see the live result in the playground:
🌐 Browser Support
| Browser | |||||
|---|---|---|---|---|---|
| <bdi> | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported in all major browsers | |||||
Tip: bdi is like dir=auto but creates a strong isolation boundary; great for untrusted user content.
❓ FAQ
QWhat does the bdi tag do?
A
<bdi> (Bi-Directional Isolation) isolates a span of text from the surrounding direction so mixed-direction content does not scramble. The classic case: usernames or comments containing Arabic/Hebrew inside an LTR list — punctuation and number order stay intact.QHow does bdi differ from the unicode-bidi CSS property?
A
<bdi> is the ready-made semantic solution: the browser detects the inner direction and isolates it. CSS unicode-bidi: isolate is the underlying mechanism and needs an explicit direction. Prefer <bdi> — simpler and semantically explicit.QWhen is bdi a must?
AWhenever you display uncontrollable third-party text: comment author names, chat nicknames, file-name lists. For example
<li><bdi>أحمد</bdi>: comment text</li> keeps the row layout stable no matter what language the name is. Static mixed text you wrote yourself rarely needs it.🏷️ Related Tags
💡 Related Cases
More case studies coming soon — check back later.