Home  >  Article  >  Web Front-end  >  How do we set text direction in HTML for content within an element?

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

PHPz
PHPzforward
2023-08-26 15:49:111448browse

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

Use the dir attribute in HTML to set the text direction of the content in the element. You can try running the following code to implement the 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>

The above is the detailed content of How do we set text direction in HTML for content within an element?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete