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显示从右到左的文本?的详细内容。