text-orientation
CSS
property sets the orientation of the text characters in a line. It only affects text in vertical mode (when
writing-mode
不是
horizontal-tb
).
It is useful for controlling the display of languages that use vertical script, and also for making vertical table headers.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
/* 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
property is specified as a single keyword from the list below.
mixed
Rotates the characters of horizontal scripts 90° clockwise. Lays out the characters of vertical scripts naturally. Default value.
upright
direction
is forced to be
ltr
.
sideways
Causes characters to be laid out as they would be horizontally, but with the whole line rotated 90° clockwise.
sideways-right
sideways
that is kept for compatibility purposes.
use-glyph-orientation
glyph-orientation-vertical
and
glyph-orientation-horizontal
.
| 初始值 |
mixed
|
|---|---|
| 适用于 | all elements, except table row groups, rows, column groups, and columns |
| 继承 | yes |
| 计算值 | 如指定 |
| 动画类型 | discrete |
mixed | upright | sideways
<p>Lorem ipsum dolet semper quisquam.</p>
p {
writing-mode: vertical-rl;
text-orientation: upright;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Writing Modes Module Level 3
The definition of 'text-orientation' in that specification. |
Proposed Recommendation | 初始定义。 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
text-orientation
|
Chrome 完整支持 48 | Edge 完整支持 79 |
Firefox
完整支持
41
|
IE 不支持 No |
Opera
完整支持
15
Prefixed
|
Safari 完整支持 14 | WebView Android 完整支持 48 | Chrome Android 完整支持 48 |
Firefox Android
完整支持
41
|
Opera Android
完整支持
14
Prefixed
|
Safari iOS 完整支持 14 | Samsung Internet Android 完整支持 5.0 |
sideways
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
44
注意事项
|
IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
44
注意事项
|
Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
完整支持
不支持
见实现注意事项。
用户必须明确启用此特征。
要求使用供应商前缀或不同名称。
writing-mode
,
text-combine-upright
,和
unicode-bidi
.
direction
text-combine-upright
text-orientation
unicode-bidi
writing-mode