Skip to content

text-combine-upright ​

描述 ​

text-combine-upright CSS 属性将字符组合设置为单个字符的空间。如果组合文本的宽度超过 1em,则用户代理必须将内容调整到 1em 以内。生成的组合被视为用于布局和装饰的单个直立字形。该属性仅在垂直书写模式下有效。 这被用来产生一种效果,在中文中被称为“横向文字”。

效果展示 ​

语法 ​

css
/* Keyword values */
text-combine-upright: none;
text-combine-upright: all;

/* Digits values */
text-combine-upright: digits; /* fits 2 consecutive digits horizontally inside vertical text */
text-combine-upright: digits 4; /* fits up to 4 consecutive digits horizontally inside vertical text */

值 ​

  • none 没有任何特殊处理。
  • all 尝试水平排版框中的所有连续字符,以便它们占据框垂直线内单个字符的空间。
  • digits <integer>? 尝试显示连续 ASCII 数字序列 (U+0030–U+0039),其字符数与指定整数相同或少于指定整数,从而占用垂直行框中单个字符的空间。如果省略整数,则计算结果为 2。2-4 范围之外的整数无效。