Bdi and bdo

BDI & BDO Visual Demo

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: rtl or 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>
Tip: Never put secret logic into direction handling; these tags only affect display order. Use <bdi> for user content (like usernames) and <bdo> only when you truly need to override display direction.

Comments

Popular posts from this blog

HTML TAGS

HTML Syntax