<bdi> Tag in HTML

The <bdi> tag stands for "Bidirectional Isolation" and is used to isolate a part of text that might be formatted in a different direction (like when mixing right-to-left and left-to-right text). It helps prevent formatting issues caused by text direction changes.

Key Points on <bdi> Tag:

Syntax of <bdi> Tag:

Syntax Example

<bdi>Your bidirectional text here</bdi>

Example of <bdi> Tag in HTML:

This example demonstrates how the <bdi> tag is used to isolate a segment of text.

Code Example


        <html>
            <head></head>
            <body>
                <p>This is a text containing an isolated مرحبا word.</p>
            </body>
        </html>
                

Output

This is a text containing an isolated مرحبا word.

The <bdi> tag ensures that the isolated content is not affected by the text direction of the surrounding content. In this case, the Arabic word "مرحبا" is displayed without being impacted by the left-to-right text of the surrounding English sentence.