<bdi>

Allows you to isolate a portion of text for display in different contexts using HTML.
2 min read
Believemy logo

The <bdi> (Bi-Directional Isolation) tag is an HTML tag useful for isolating a portion of text to manage its display in contexts where writing directions (left to right or right to left) are mixed.

It is particularly useful for ensuring correct presentation of multilingual content or texts containing sensitive data, such as names or identifiers, which can disrupt the layout if they follow a different writing direction.

 

Structure and syntax of the <bdi> tag

Basic structure and syntax

The <bdi> tag is a container tag that has:

  • An opening tag: <bdi>.
  • A closing tag: </bdi>.

Here is a simple example:

HTML
<bdi>Isolated text</bdi>

 

Usage example

Here is a practical example:

HTML
<p>User name: <bdi>John Doe</bdi></p>

In this example, the name "John Doe" is isolated from its context to ensure that its display respects the original writing order.

 

Difference with other similar tags

  • <span>: Allows styling portions of text but does not manage directionality.
  • <bdo>: Forces the directionality of the text, unlike <bdi>, which leaves it independent of the context.

 

Browser compatibility

The <bdi> tag is supported by most modern browsers.

BrowserCompatibility
ChromeYes
FirefoxYes
SafariYes
EdgeYes
Internet ExplorerPartial (IE 10+)

Related terms

Discover our hTML and CSS glossary

Browse the terms and definitions most commonly used in HTML and CSS development.

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.