HTML Standard attribute: dir
[this page | pdf | back links]
The HTML dir attribute specifies the direction
of the text content of an element.
Valid attribute
values (for <bdo>)
include:
Value
|
Description
|
ltr
|
Left-to-right
|
rtl
|
Right-to-left
|
EXAMPLE:
HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Set using HTML:<br>
<input type="text" value="text1" dir="rtl">
<br><br>Set using JavaScript:<br>
<input id="x1" type="text" value=text2>
<br><br>Set using JavaScript:<br>
<input id="x2" type="text" value=text2>
<script>
var att = document.createAttribute("dir");
att.value = "rtl";
document.getElementById("x1").setAttributeNode(att);
document.getElementById("x2").dir="rtl";
</script>
</body>
</html>
|
NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes