There are 3 internationalization attributes that can be used with most XHTML elements (but not all elements).
7.1. The dir Attribute
The dir attribute lets you tell the browser which direction the text should flow in. The dir attribute can take two values, as you can see in the table below:
| Value | Meaning |
|---|---|
| ltr (left to right) | Left to right (the default value) |
| rtl (right to left) | Right to left (for languages such as Hebrew or Arabic, which are read from right to left) |
Source Code:
Watch the video:
<!DOCTYPE html>
<html dir="rtl">
<head>
<title>dir attribute example</title>
</head>
<body>
<p>This text flows from right to left.</p>
<p dir="ltr">
This text is displayed left to right.
</p>
<p>This text flows from right to left.</p>
</body>
</html>Result:
When the dir attribute is used in the <html> tag, it sets how text is displayed for the entire document. But when it is used in another tag, it controls the text direction only for the content of that tag.
Watch the video:
Ebook: https://softkhpc.blogspot.com/2026/11/html-tutorial-beginners.html


