如何使用 HTML 從右到左顯示文字?
direction 屬性指定網頁中塊元素內的文字方向。
我們在 HTML 中使用 style 屬性來設定文字方向。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>
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
IOS
HTML
CSS
Android
Python
C 語言
C++
C#
MongoDB
MySQL
Javascript
PHP