Create a paragraph with a right-to-left direction in HTML5



Use the dir attribute in HTML to set a paragraph with right-to-left direction. Add the value rtl to the dir attribute for the text to be placed from right-to-left.

Example

You can try to run the following code to implement dir attribute −

<!DOCTYPE html>
<html>
   <body>
      <p dir="rtl">This is demo paragraph. This is demo paragraph.
         This is demo paragraph. This is demo paragraph. This is demo paragraph.
         This is demo paragraph. This is demo paragraph.</p>
   </body>
</html>

Advertisements