direction属性指定了网页中块级元素内文本的方向。
我们使用style属性在HTML中设置文本方向。style属性为块内的元素指定了内联样式。style属性与CSS属性direction一起使用,用于设置文本的方向。
语法
以下是使用CSS属性设置文本方向(从右到左)的语法。
<p style = "direction: rtl;">The text…</p>
示例
以下是在 HTML 中设置 <p> 元素方向的示例程序。
<!DOCTYPE html> <html> <head> </head> <body> <p style = "direction: rtl;"> whiteboards are so often at the core of a collaborative process </p> </body> </html>
示例
以下是在 HTML 中设置 <h2> 元素方向的示例程序。
<!DOCTYPE html> <html> <head> </head> <body> <h2 style = "direction: rtl;"> Hallowen season it is... </h2> </body> </html>
示例
以下是在HTML中设置<ul>元素方向的示例程序。
<!DOCTYPE html> <html> <head> </head> <body> <ul style = "direction: rtl;"> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> </body> </html>
以上就是如何使用HTML显示从右到左的文本?的详细内容,更多请关注编程之家其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。