text-orientation
尝试一下
writing-mode: vertical-rl;
text-orientation: mixed;
writing-mode: vertical-rl;
text-orientation: upright;
In another moment down went Alice after it, never once considering how in
the world she was to get out again.
语法
css/* Keyword values */
text-orientation: mixed;
text-orientation: upright;
text-orientation: sideways-right;
text-orientation: sideways;
text-orientation: use-glyph-orientation;
/* Global values */
text-orientation: inherit;
text-orientation: initial;
text-orientation: unset;
text-orientation 应当被设置为上述关键字之一。
值
mixed
默认值。顺时针旋转水平书写的字符 90°,将垂直书写的文字自然布局。
upright
将水平书写的字符自然布局(直排),包括垂直书写的文字(as well as the glyphs for vertical scripts)。注意这个关键字会导致所有字符被视为从左到右,也就是 direction 被强制设为 ltr。
sideways
所有字符被布局为与水平方式一样,但是整行文本被顺时针旋转 90°。
sideways-right
处于兼容目的,sideways 的别名。
use-glyph-orientation
对于 SVG 元素,这个关键字导致使用已弃用的 SVG 属性。 glyph-orientation-vertical 和 glyph-orientation-horizontal。
形式化定义
初始值mixed适用元素all elements, except table row groups, rows, column groups, and columns是否是继承属性是计算值as specified动画类型Not animatable
形式化语法
text-orientation = mixed | upright | sideways
来源:CSS Writing Modes Level 4
例子
HTML
html
Lorem ipsum dolet semper quisquam.
CSS
cssp {
writing-mode: vertical-rl;
text-orientation: upright;
}
结果
规范
Specification
CSS Writing Modes Level 4# text-orientation
浏览器兼容性
Loading…
参见
The other vertical-script related CSS properties: writing-mode, text-combine-upright, and unicode-bidi.
CSS Logical properties
Styling vertical text (Chinese, Japanese, Korean and Mongolian)
Extensive browsers support test results: https://w3c.github.io/i18n-tests/results/horizontal-in-vertical.html#text_orientation
Help improve MDN
Was this page helpful to you?
Yes
No
Learn how to contribute
This page was last modified on 2025年7月15日 by MDN contributors.
View this page on GitHub • Report a problem with this content
