--- title: text-orientation slug: Web/CSS/text-orientation tags: - CSS - 书写方式 - 书写模式 - 文字方向 translation_of: Web/CSS/text-orientation ---
text-orientation CSS 属性设定行中字符的方向。但它仅影响纵向模式(当 {{cssxref("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;
text-orientation 应当被设置为上述关键字之一。
mixeduprightltr。sidewayssideways-rightsideways 的别名。use-glyph-orientationglyph-orientation-vertical 和 glyph-orientation-horizontal。{{CSSInfo}}
<p>Lorem ipsum dolet semper quisquam.</p>
p {
writing-mode: vertical-rl;
text-orientation: upright;
}
{{EmbedLiveSample('例子')}}
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('CSS3 Writing Modes', '#text-orientation', 'text-orientation')}} | {{Spec2('CSS3 Writing Modes')}} | Initial definition. |
{{Compat("css.properties.text-orientation")}}