Computer >> Computer tutorials >  >> Programming >> Javascript

How do we include the direction of text display in HTML?


Use the dir attribute in HTML, to add the direction of the text.

Example

You can try to run the following code to include the direction of text display in HTML −

<!DOCTYPE html>
<html>
   <body>
      <p>This is demo text from left-to-right.</p>
      <p dir = "rtl">This is demo text from right-to-left.</p>
   </body>
</html>