The text-combine-upright
CSS property sets the combination of characters into the space of a single character. If the combined text is wider than 1em, the user agent must fit the contents within 1em. The resulting composition is treated as a single upright glyph for layout and decoration. This property only has an effect in vertical writing modes.
This is used to produce an effect that is known as tate-chū-yoko (縦中横) in Japanese, or as 直書橫向 in Chinese.
/* 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 */ /* Global values */ text-combine-upright: inherit; text-combine-upright: initial; text-combine-upright: unset;
Syntax
Values
none
- There is no special processing.
all
- Attempts to typeset all consecutive characters within the box horizontally, such that they take up the space of a single character within the vertical line of the box.
digits <integer>?
- Attempts to display a sequence of consecutive ASCII digits (U+0030–U+0039) that has as many or fewer characters than the specified integer, such that it takes up the space of a single character within the vertical line box. If the integer is omitted, it computes to 2. Integers outside the range of 2-4 are invalid.
Formal definition
Initial value | none
|
Applies to | non-replaced inline elements |
Inherited | yes |
Computed value | specified keyword, plus integer if 'digits' |
Animation type | discrete |
Formal syntax
none | all | [ digits <integer>? ]
Examples
Digits
The digits value requires less markup than the all value when digits are being combined, but it is currently not very widely supported by browsers.
HTML
<p lang="ja" class="exampleText">平成20年4月16日に</p>
CSS
.exampleText {
writing-mode: vertical-lr;
text-combine-upright: digits 2;
font: 36px serif;
}
Results
Screenshot | Live sample |
---|---|
[[File:../../../../../media.prod.mdn.mozit.cloud/attachments/2015/12/14/12127/ba14e0081d73fef81bef079747b5f891/tate-chu-yoko.png|class=internal]] |
All
The all value requires markup around every piece of horizontal text, but it is currently supported by more browsers than the digits value.
HTML
<p lang="zh-Hant">民國<span class="num">105</span
>年<span class="num">4</span
>月<span class="num">29</span>日</p>
CSS
html { writing-mode: vertical-rl; font: 24px serif }
.num { text-combine-upright: all }
Results
Screenshot | Live sample |
---|---|
[[File:../../../../../media.prod.mdn.mozit.cloud/attachments/2016/04/29/13096/5c05849fba8b035a785ee894078f23e4/text-combine-upright-all.png|class=internal]] |
Specifications
Specification | Status | Comment |
---|---|---|
CSS Writing Modes Level 4The definition of 'text-combine-upright' in that specification. | Candidate Recommendation | Add digits value
|
CSS Writing Modes Module Level 3The definition of 'text-combine-upright' in that specification. | Proposed Recommendation | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
text-combine-upright
|
Chrome Full support 48 Full support 48 Partial support 9 Notes' This property was initially named |
Edge Full support 12 Full support 12 Alternate Name' Uses the non-standard name: |
Firefox Full support 81 Full support 81 Notes' Before version 81, Firefox implemented the property as animatable. This was corrected to spec in 81. Full support 48 Notes' Before version 48, Firefox did not implement layout support for tate-chū-yoko. Full support 41 Disabled' From version 41: this feature is behind the Disabled' From version 31 until version 41 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
IE Full support 11 Full support 11 Alternate Name' Uses the non-standard name: |
Opera Full support 35 Full support 35 Partial support 15 Notes' This property was initially named |
Safari Partial support 5.1 Partial support 5.1 Notes' This property was initially named |
WebView Android Full support 48 Full support 48 Partial support ≤37 Notes' This property was initially named |
Chrome Android Full support 48 Full support 48 Partial support 18 Notes' This property was initially named |
Firefox Android Full support 81 Full support 81 Notes' Before version 81, Firefox implemented the property as animatable. This was corrected to spec in 81. Full support 48 Notes' Before version 48, Firefox did not implement layout support for tate-chū-yoko. Full support 41 Disabled' From version 41: this feature is behind the Disabled' From version 31 until version 41 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
Opera Android Full support 35 Full support 35 Partial support 14 Notes' This property was initially named |
Safari iOS Partial support 5 Partial support 5 Notes' This property was initially named |
Samsung Internet Android Full support 5.0 Full support 5.0 Partial support 1.0 Notes' This property was initially named |
digits
|
Chrome
No support No |
Edge
No support 12 — 79 |
Firefox Full support 48 Full support 48 Notes' Firefox recognizes this value but does not yet implement layout support for tate-chū-yoko (see bug 1258635).
Disabled' From version 48: this feature is behind the |
IE
Full support 11 |
Opera
No support No |
Safari
No support No |
WebView Android
No support No |
Chrome Android
No support No |
Firefox Android Full support 48 Full support 48 Notes' Firefox recognizes this value but does not yet implement layout support for tate-chū-yoko (see bug 1258635).
Disabled' From version 48: this feature is behind the |
Opera Android
No support No |
Safari iOS
No support No |
Samsung Internet Android
No support No |
Legend
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- See implementation notes.'
- See implementation notes.
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
- Uses a non-standard name.'
- Uses a non-standard name.
See also
text-combine-upright by Mozilla Contributors is licensed under CC-BY-SA 2.5.