Text Content

HTML <bdi> element

Isolates a span of bidirectional text from its surroundings. Useful for user names whose text direction is unknown. Direction isolation helps prevent surrounding punctuation and labels from being reordered by mixed-direction names. Its default direction is auto; this differs from explicitly overriding direction with bdo. It accepts global HTML attributes; individual global features may be inapplicable or restricted.

Formal Syntax & Structure

html syntaxhtml
<bdi>Text</bdi>

Return Value

HTMLElement

Content model: Phrasing content, with element-specific restrictions.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>HTML example</title>  </head>  <body>    <p>      User      <bdi>علی</bdi>      : 12 points    </p>  </body></html>
HTML Reference