Bdi and bdo
BDI & BDO Visual Demo
Interactive demo that shows how <bdi> isolates direction and <bdo dir="rtl"> forces direction. Try controls below.
1) Basic mixing (no BDI/BDO)
<mix>
Alice (علي) — score: 120
← LTR
↔
RTL →
2) Using
<bdi> (isolation)
<bdi>
Name: Alice (علي) — score: 120
3) Using
<bdo dir="rtl"> (override)
<bdo dir="rtl">
Name: Alice (علي) — score: 120
4) Edge case: numbers + mixed text
numbers
Order # 123ABC — customer: علي 2025
How to remember (cartoon rules)
Short memory rules and live HTML snippets you can copy/paste.
Memory rules
- <bdi> = bubble 🫧 → isolate unknown text so it doesn’t flip other parts.
- <bdo dir="rtl"> = arrow 🧭 → force content to read right-to-left.
- Use
direction: rtlor page-level<html dir="rtl">to change whole page direction.
Copyable snippets
<!-- isolate unknown name -->
<span>User: <bdi>علي</bdi></span>
<!-- force RTL for special text -->
<span>Label: <bdo dir="rtl">Hello</bdo></span>
Comments
Post a Comment