dir attribute:
It is used to specify the direction of text in Html element content. In Html5 it can be used with any html element. Prior to Html5 it cannot be used with <base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param>, and <script> tag .
Syntax:
<element dir="ltr|rtl|auto">
Attribute Values:
Value |
Description |
ltr |
Left-to-right text direction(Default) |
rtl |
Right-to-left text direction |
auto |
Browser figure out the text direction, based on the content |
Example:
<!DOCTYPE html>
<html>
<body>
<h4>Paragraph direction will from right to left</h4>
<p dir="rtl">keep in touch!</p>
<h4>Paragraph direction will from left to right</h4>
<p dir="ltr">keep in touch!</p>
</body>
</html>
In the above example the first <p> tag will appear on right side(right to left) and the other on left side (left to right).
0 Comment(s)