HTML - DOM Style Object unicodeBidi Property



HTML DOM Style Object unicodeBidi property specifies how bidirectional text in a document is displayed. It overrides the algorithm(Unicode) and allows to control the text embedding.

Syntax

Set the unicodeBidi property:
object.style.unicodeBidi= "normal | embed | bidi-override | initial | inherit";
Get the unicodeBidi property:
object.style.unicodeBidi;

Property Values

Value Description
normal It is the default value which does not create any additional level of embedding.
embed It is used for creating an additional level of embedding.
bidi-override It also creates an additional level of embedding and reorders the text based on direction property.
initial It is used to set this property to it's default value.
inherit It is used to inherit the property of it's parent element.

Return Value

It returns a string value which represents the level of embedding with respect to the bidirectional algorithm.

Example of HTML DOM Style Object 'unicodeBidi' Property

The following example illustrates unicodeBidi property applied on div element with direction right-to-left.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>
        HTML DOM Style Object unicodeBidi Property
    </title>
    <style>
        #bidi {
            direction: rtl;
            border: 1px solid black;
        }
    </style>
</head>
<body>
    <p>
        Override the text content of div element.     
    </p>
    <button onclick="fun()">Override text</button>
    <button onclick="funTwo()">Embed text</button>
    <br><br>
    <div id="bidi">
        Welcome to Tutorials Pooint.
    </div>
    <script>
        function fun() {
            document.getElementById("bidi")
                .style.unicodeBidi = "bidi-override";
        }
        function funTwo() {
            document.getElementById("bidi")
                .style.unicodeBidi = "embed";
        }
    </script>
</body>
</html>

Supported Browsers

Property Chrome Edge Firefox Safari Opera
unicodeBidi Yes 2 Yes 12 Yes 1 Yes 1.3 Yes 9.2
html_dom.htm
Advertisements