/

HTML / CSS / JavaScript Tutorial

HTML Element: <bdi>

[this page | pdf | back links]

The HTML <bdi> element indicates material that might be formatted in a different direction from other material surrounding the element. ‘bdi’ stands for ‘bi-directional isolation’. It is new in HTML 5. A similar effect can usually be achieved using the unicode-bidi style applied to e.g. a span element, but the semantic meaning is only conveyed by the <bdi> element and in some cases browsers may ignore CSS, but not a <bdi> element.

 

To create or access such an element in JavaScript see here. The corresponding HTML DOM object supports standard DOM properties and methods. The default style applicable to this element is shown here.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<bdi>bdi text</bdi>

<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var x = document.createElement("BDI");
x.textContent = "bdi text";
// or use var txt = document.createTextNode("bdi text");
// x.appendChild(txt);
document.getElementById("element").appendChild(x);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile