CSS

写入模型 | writing-mode

writing-mode

writing-modeCSS属性定义文本行是否水平或垂直布置以及块扩展的方向。

/* Keyword values */ writing-mode: horizontal-tb; writing-mode: vertical-rl; writing-mode: vertical-lr; /* Global values */ writing-mode: inherit; writing-mode: initial; writing-mode: unset;

语法

该属性指定块流向,即块级别容器堆叠的方向,以及内联级别内容在块容器内流动的方向。因此,writing-mode属性也决定了块级内容的排序。

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

可能值

horizontal-tb——内容按从左到右水平从上到下垂直流动。下一条水平线位于上一条线的下方。

形式语法

horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr

实例

实际结果

规范

SpecificationStatusComment
CSS Writing Modes Module Level 3The definition of 'writing-mode' in that specification.Candidate RecommendationInitial definition
UnknownThe definition of 'writing-mode' in that specification.UnknownAdd sideways-lr and sideways-rl

浏览器兼容性

FeatureChromeEdgeFirefoxInternet Explorer (defunct)OperaSafari
Basic support8-webkit (Yes)(Yes)-webkit (Yes)41 (41)19-ms215-webkit5.1-webkit
lr48 (uprefixed)(Yes)43 (43)9-ms2(Yes)?

FeatureAndroidAndroid WebviewChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support3-webkit(Yes)47-webkit (Yes)(Yes)-webkit (Yes)41.0 (41) 1??5.1 -webkit
SVG 1.1 values lr, lr-tb, rl, tb, tb-rl?48.0 (uprefixed)48.0 (uprefixed)(Yes)43.0 (43)???
sideways-rl,sideways-lrNo support4No supportNo supportNo support????
vertical-lrvertical-rlNo support4No supportNo supportNo support???

另见

  • SVG writing-mode attribute

  • direction

  • unicode-bidi

  • text-orientation

  • text-combine-upright