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 属性