How do we set the text direction for the content in an element in HTML?

HTMLFront End TechnologyWeb Development

Use the dir attribute in HTML, to set the text direction for the content in an element. You can try to run the following code to implement dir attribute −

Example

<!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>
raja
Published on 13-Mar-2018 16:43:22
Advertisements