direction屬性指定了網(wǎng)頁(yè)中塊級(jí)元素內(nèi)文本的方向。
我們使用style屬性在HTML中設(shè)置文本方向。style屬性為塊內(nèi)的元素指定了內(nèi)聯(lián)樣式。style屬性與CSS屬性direction一起使用,用于設(shè)置文本的方向。
語(yǔ)法
以下是使用CSS屬性設(shè)置文本方向(從右到左)的語(yǔ)法。
<p style = "direction: rtl;">The text…</p>
登錄后復(fù)制
示例
以下是在 HTML 中設(shè)置 <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>
登錄后復(fù)制
示例
以下是在 HTML 中設(shè)置 <h2> 元素方向的示例程序。
<!DOCTYPE html> <html> <head> </head> <body> <h2 style = "direction: rtl;"> Hallowen season it is... </h2> </body> </html>
登錄后復(fù)制
示例
以下是在HTML中設(shè)置<ul>元素方向的示例程序。
<!DOCTYPE html> <html> <head> </head> <body> <ul style = "direction: rtl;"> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> </body> </html>
登錄后復(fù)制
以上就是如何使用HTML顯示從右到左的文本?的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!