CSS text-orientation 屬性
- 上一頁 text-justify
- 下一頁 text-overflow
定義和用法
text-orientation
屬性指定字符的方向。
注意:僅當 writing-mode 設置為垂直時才有效。
實例
例子 1
為不同的 <div> 元素設置文本方向:
div.a { text-orientation: mixed; } div.b { text-orientation: upright; }
例子 2
text-orientation
屬性可用于更改表格表頭的方向:
th { writing-mode: vertical-lr; text-orientation: upright; }
CSS 語法
text-orientation: mixed|upright|sideways|sideways-right|use-glyph-orientation|initial|inherit;
屬性值
值 | 描述 |
---|---|
mixed | 默認值。字符順時針旋轉 90 度。 |
upright | 字符不旋轉,保持直立。 |
sideways | 字符的方向與 writing-mode 為垂直時文本行的方向相同,即順時針旋轉 90 度。 |
sideways-right | 等于 sideways 屬性值。保留用于兼容性目的。 |
use-glyph-orientation | 用于 SVG 元素,以便文本繼承已棄用的 SVG 屬性 glyph-orientation-vertical 和 glyph-orientation-horizontal。 |
initial | 將此屬性設置為其默認值。參閱 initial。 |
inherit | 從其父元素繼承此屬性。參閱 inherit。 |
技術細節
默認值: | mixed |
---|---|
繼承性: | yes |
動畫制作: | 不支持。請參閱:動畫相關屬性。 |
版本: | CSS3 |
JavaScript 語法: | object.style.textOrientation="upright" |
瀏覽器支持
表格中的數字表示首個完全支持該屬性的瀏覽器版本。
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
48.0 | 79.0 | 41.0 | 14.0 | 35.0 |
相關頁面
- 上一頁 text-justify
- 下一頁 text-overflow