HTML <bdi> Bi-Directional Isolation Tag
Tags: learnhtml
Published: 2021-02-13 10:12:41

---
title: HTML <bdi> Bi-Directional Isolation Tag
published: true
date: 2021-02-12 08:40:36 UTC
tags: LearnHTML
canonical_url: https://sharepointanchor.com/learn-html/html-bdi-tag/
---

The HTML **<bdi>** tag stands for **Bi-Directional Isolation** tag. That means it will **isolate a part of the text** that might be formatted in a different direction from the rest of the text. The <bdi> tas is **new in HTML 5**. It is helpful for languages such as **Arabic** or **Hebrew** when embedding user-generated content with an unknown text direction.

The Bi-Directional text can contain both the sequences of characters arranged from **right-to-left (RTL)** and another sequence of characters that are arranged **left-to-right (LTR)**. For instance, the **Latin** characters are treated as **<abbr title="Left-to-Right">LTR</abbr>** while the **Arabic** characters are treated as **<abbr title="Right-to-Left">RTL</abbr>**.

**Note** : The <bdi> tag does **not physically turn the text** , it only tells the browser that it should **read the text in the opposite direction**.

The browsers implement the **Unicode Bidirectional Algorithm** to handle this. Usually, the **<bdi>** element will work properly and there **won’t be a need to provide a special markup**.

The **<bdi>** tag is similar to **<bdo>**. The main difference between these two elements is that the **<bdi>** tag **separates and changes the direction of the text** , while the **<bdo>** tag **only reverses the direction**.

<svg aria-hidden="true" focusable="false" data-icon="clock" width="20" height="20" fill="none" stroke="currentColor" style="display:inline-block;vertical-align:-0.1em" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>Estimated reading time: 4 minutes

## Syntax:

The <bdi> tag contains both an **opening <bdi> tag** and **closing </bdi> tag**. The content is written between these two tags.

```

<bdi dir="rtl"> text </bdi>

```

## Sample of the HTML <bdi> Tag:

```

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <h1> Sample of Bidirectional tag</h1>
    <p dir="ltr"><bdi>مرحبا بعودتك</bdi><br>This sentence in Arabic is automatically displayed from right to left.</p>
  </body>
</html>

```

## Result:

![](https://sharepointanchor.com/wp-content/uploads/2021/02/Result-11.png)<figcaption>Result</figcaption>

## Attributes: 

The  **<bdi>**  tag supports the  **global attributes**  and the  **event attributes**.

## Styling Methods for <bdi> Tag:

You can use the following **[CSS](https://sharepointanchor.com/learn-css/)** properties to style an [HTML](https://sharepointanchor.com/category/learn-html/) bidirectional isolation tag.

### Properties to style the visual weight/emphasis/size of the text in <bdi> tag:

- **[CSS](https://sharepointanchor.com/category/learn-css/ "CSS") font-style** – This CSS property helps to set the font style of the text such as normal, italic, oblique, initial, inherit.
- **CSS font-family** – This CSS property specifies a prioritized list of one or more font family names or generic family names for the selected element.
- **CSS font-size** – This CSS property will help to set the size of the font.
- **CSS font-weight** – This CSS property used to define whether the font should be bold or thick.
- **CSS text-transform** – This CSS property will control the text case and capitalization.
- **CSS test-decoration** – This CSS property specifies the decoration added to text such as **text-decoration-line** , **text-decoration-color** , **text-decoration- style**.

### Styles to coloring the text in <bdi> Tag:

- **CSS color** – This CSS property will specify the color of the text content and decorations.
- **CSS background-color** – This CSS property helps to set the background color of an element. 

### Text layout styles for <bdi> Tag:

- **CSS text-indent** – This CSS property is used to specify the indentation of the first line in a text block.
- **CSS text-overflow ** – This CSS property helps to describe how overflowed content that is not displayed should be signaled to the user.
- **CSS white-space** – This CSS property describes how white-space inside an element is handled.
- **CSS word-break**  – This CSS property decides where the lines should be broken.

### Other Properties for <bdi> Tag:

- **CSS text-shadow**  – This CSS property helps to add the shadow to text.
- **CSS text-align-last**  – This CSS property will set the alignment of the last line of the text.
- **CSS line-height** – This CSS property defines the height of a line.
- **CSS letter-spacing** – This CSS property helps to decide the spaces between letters/characters in a text.
- **CSS word-spacing** – This CSS property specifies the spacing between every word.

## Browser Support:

![](https://sharepointanchor.com/wp-content/uploads/2021/02/Browser-Support-3.png)<figcaption>Browser Support</figcaption>

### Related Articles:

- **[HTML <aside> Aside Tag](https://sharepointanchor.com/learn-html/html-aside-tag/)**
- **[HTML <abbr> Abbreviation Tag](https://sharepointanchor.com/learn-html/html-abbreviation-tag/)**
- **[Basic HTML Definitions and Usages in the Real World](https://sharepointanchor.com/learn-html/basic-html-definitions-and-usages-in-real-world/)**
- **[HTML <address> Address Tag](https://sharepointanchor.com/learn-html/html-address-tag/)**
- **[HTML <acronym> Acronym Tag](https://sharepointanchor.com/learn-html/html-acronym-tag/)**

The post [HTML <code><bdi></code> Bi-Directional Isolation Tag](https://sharepointanchor.com/learn-html/html-bdi-tag/) appeared first on [Share Point Anchor](https://sharepointanchor.com).