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顯示從右到左的文本?的詳細內容,更多請關注www.92cms.cn其它相關文章!






