The direction attribute specifies the direction of text within block-level elements in a web page.
We use the style attribute to set the text direction in HTML. The style attribute specifies inline styles for elements within the block. The style attribute is used together with the CSS property direction to set the direction of text.
The following is the syntax for setting text direction (right to left) using CSS properties.
<p style = "direction: rtl;">The text…</p>
The following is a sample program to set the direction of the
element in HTML.
<!DOCTYPE html> <html> <head> </head> <body> <p style = "direction: rtl;"> whiteboards are so often at the core of a collaborative process </p> </body> </html>
The following is a sample program to set the direction of the
<!DOCTYPE html> <html> <head> </head> <body> <h2 style = "direction: rtl;"> Hallowen season it is... </h2> </body> </html>
The following is a sample program to set the direction of the
<!DOCTYPE html> <html> <head> </head> <body> <ul style = "direction: rtl;"> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> </body> </html>
The above is the detailed content of How to display right-to-left text using HTML?. For more information, please follow other related articles on the PHP Chinese website!