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
Lays out the characters of horizontal scripts naturally (upright), as well as the glyphs for vertical scripts. Note that this keyword causes all characters to be considered as left-to-right: the used value of 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
An alias to sideways that is kept for compatibility purposes.
use-glyph-orientation
On SVG elements, this keyword leads to use the value of the deprecated SVG properties glyph-orientation-vertical and glyph-orientation-horizontal .

形式定义

初始值 mixed
适用于 all elements, except table row groups, rows, column groups, and columns
继承 yes
计算值 如指定
动画类型 discrete

形式句法

mixed | upright | sideways
					

范例

HTML

<p>Lorem ipsum dolet semper quisquam.</p>
					

CSS

p {
  writing-mode: vertical-rl;
  text-orientation: upright;
}
					

结果

规范

规范 状态 注释
CSS Writing Modes Module Level 3
The definition of 'text-orientation' in that specification.
Proposed Recommendation 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
text-orientation Chrome 完整支持 48 Edge 完整支持 79 Firefox 完整支持 41
完整支持 41
不支持 38 — 51 Disabled
Disabled ). To change preferences in Firefox, visit
IE 不支持 No Opera 完整支持 15 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Safari 完整支持 14 WebView Android 完整支持 48 Chrome Android 完整支持 48 Firefox Android 完整支持 41
完整支持 41
不支持 38 — 51 Disabled
Disabled ). To change preferences in Firefox, visit
Opera Android 完整支持 14 Prefixed
完整支持 Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Safari iOS 完整支持 14 Samsung Internet Android 完整支持 5.0
sideways Chrome 不支持 No Edge 不支持 No Firefox 完整支持 44 注意事项
完整支持 44 注意事项
注意事项 sideways-right has become an alias of sideways .
IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 完整支持 44 注意事项
完整支持 44 注意事项
注意事项 sideways-right has become an alias of sideways .
Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

见实现注意事项。

用户必须明确启用此特征。

用户必须明确启用此特征。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

另请参阅

元数据

  • 最后修改:
  1. CSS
  2. CSS 参考
  3. CSS Writing Modes
  4. 特性
    1. direction
    2. text-combine-upright
    3. text-orientation
    4. unicode-bidi
    5. writing-mode

Copyright  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1