CSS

文字方向 | text-orientation

text-orientation

text-orientation CSS属性定义行内文本字符的方向。此属性仅在垂直模式下有效,即writing-mode不是horizontal-tb。这对控制使用垂直脚本的语言的显示以及制作垂直表头是很有用的。

/* 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;

Initial valuemixed
Applies toall elements, except table row groups, rows, column groups, and columns
Inheritedyes
Mediavisual
Computed valueas specified
Animation typediscrete
Canonical orderthe unique non-ambiguous order defined by the formal grammar

语法

text-orientation属性可取值如下:

可能值

mixed——将水平脚本的字符旋转90°。自然地表现垂直脚本的特征。默认值。

形式语法

mixed | upright | sideways

实例

HTML

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

CSS

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

结果

规范

SpecificationStatusComment
CSS Writing Modes Module Level 3The definition of 'text-orientation' in that specification.Candidate RecommendationInitial definition.

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support(Yes) -webkit 48.0 (unprefixed)41 (41)1No support(Yes) -webkitNo support
sidewaysNo support44 (44)2No supportNo supportNo support

FeatureAndroidAndroid WebviewChrome for AndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic supportNo support48.048.041.0 (41)1No supportNo supportNo support
sidewaysNo supportNo supportNo support44.0 (44)2No supportNo supportNo support