CSS text-orientation 屬性
示例
為不同的 <div> 元素設定文字方向
div.a {
text-orientation: mixed;
}
div.b {
text-orientation: upright;
}
自己動手試一試 »
定義和用法
text-orientation
屬性指定字元的方向。
注意: 僅當 writing-mode 設定為 vertical 時才有效。
瀏覽器支援
表中的數字指定了完全支援該屬性的第一個瀏覽器版本。
屬性 | |||||
---|---|---|---|---|---|
text-orientation | 48.0 | 79.0 | 41.0 | 14.0 | 35.0 |
CSS 語法
text-orientation: mixed|upright|sideways|sideways-right|use-glyph-orientation|initial|inherit;
屬性值
值 | 描述 | 演示 |
---|---|---|
混合 | 預設值。字元順時針旋轉 90 度。 | 演示 ❯ |
upright | 字元不旋轉,但垂直向上。 | 演示 ❯ |
sideways | 字元的方向與 writing-mode vertical 時文字行的方向相同,順時針旋轉 90 度。 | |
sideways-right | 與屬性值 sideways 相同。為相容性而保留。 | |
use-glyph-orientation | 用於 SVG 元素,以便文字繼承已棄用的 SVG 屬性 glyph-orientation-vertical 和 glyph-orientation-horizontal。 | |
initial | 將此屬性設定為其預設值。閱讀關於initial | |
inherit | 從其父元素繼承此屬性。閱讀關於inherit |
更多示例
示例
text-orientation 屬性可用於更改表格標題中的方向
th {
writing-mode: vertical-lr;
text-orientation: upright;
}
自己動手試一試 »
相關頁面
CSS writing-mode 屬性:CSS Writing Mode 屬性