
direction属性指定了网页中块级元素内文本的方向。
我们使用style属性在HTML中设置文本方向。style属性为块内的元素指定了内联样式。style属性与CSS属性direction一起使用,用于设置文本的方向。
语法
以下是使用CSS属性设置文本方向(从右到左)的语法。
<p style = "direction: rtl;">The text…</p>
示例
以下是在 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>
示例
以下是在 HTML 中设置
元素方向的示例程序。
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2 style = "direction: rtl;">
Hallowen season it is...
</h2>
</body>
</html>
示例
以下是在HTML中设置
- 元素方向的示例程序。
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul style = "direction: rtl;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>

