bdi

Table of contents

  1. 1. Summary
  2. 2. Usage Context
  3. 3. Attributes
    1. 3.1. DOM Interface
    2. 3.2. Examples
      1. 3.2.1. Result
    3. 3.3. Compatibility
    4. 3.4. See also
Table of contents
  1. 1. Summary
  2. 2. Usage Context
  3. 3. Attributes
    1. 3.1. DOM Interface
    2. 3.2. Examples
      1. 3.2.1. Result
    3. 3.3. Compatibility
    4. 3.4. See also

Summary

The HTML Bi-directional Isolation Element (<bdi>) isolates a span of text that might be formatted in a different direction from other text outside it.

This element is useful when embedding text with an unknown directionality, from a database for example, inside text with a fixed directionality.

Though the same visual effect can be achieve using the CSS rule unicode-bidi : isolate on a <span> or another text-formatting element, the semantic meaning is only conveyed by the <bdi> element. Especially, browsers are allowed to ignore CSS styling. In such a case, the text would still be correctly displayed using the HTML element, but will become garbage when using the CSS styling to convey semantic.

Usage Context

Permitted content Phrasing content.
Tag omission None, must have both a start tag and an end tag.
Permitted parent elements Any element that accepts phrasing content.
Normative document HTML 5, section 4.6.23

Attributes

Like all other HTML elements, this element has the global attributes, with a slight semantic difference: the dir attribute is not inherited. If not set, its default value is the auto which let the browser decide the direction based on the element's content.

DOM Interface

This element implements the HTMLElement interface.

Examples

<p dir="ltr">This arabic word <bdi>ARABIC_PLACEHOLDER</bdi> is automatically displayed right-to-left.</p>

Result

This arabic word REDLOHECALP_CIBARA is automatically displayed right-to-left

Compatibility

  • Desktop
  • Mobile

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 16 10.0 (10.0) -- -- --
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support -- 10.0 (10.0) -- -- --

See also

Tags (4)

Edit tags

Attachments (0)

 

Attach file