CSS - text-orientation 属性



text-orientation 属性指定一行中文本字符的方向。

此属性仅在垂直书写模式下有效。此属性主要用于垂直书写,例如日语、中文等语言,以及创建垂直表格标题。

可能的值

  • mixed:将水平脚本的字符顺时针旋转 90°。自然地布置垂直脚本的字符。默认值。

  • upright:自然地(垂直)布置水平脚本的字符,以及垂直脚本的字形。

  • sideways:使字符按水平方向排列,但整行顺时针旋转 90°。

  • sideways-rightsideways 的别名,出于兼容性目的而保留。

  • use-glyph-orientation:在 SVG 元素上,此关键字会导致使用已弃用的 SVG 属性 glyph-orientation-vertical 和 glyph-orientation-horizontal 的值。

应用于

所有 HTML 元素,除了表格行组、行、列组和列。

Explore our latest online courses and learn new skills at your own pace. Enroll and become a certified expert to boost your career.

DOM 语法

object.style.textOrientation = mixed | upright | sideways ;

CSS text-orientation - 基本示例

以下示例演示了如何使用text-orientation 属性

Open Compiler
<html> <head> <style> p { writing-mode: vertical-rl; text-orientation: upright; } </style> </head> <body> <h2>Text Orientation</h2> <p>welcome to tutorialspoint</p> </body> </html>
广告