CSS text-combine-upright Property
The CSS text-combine-upright property controls whether multiple characters are combined into a single upright unit within vertical text.
It is primarily used in vertical writing systems, particularly East Asian typography, to display short sequences of numbers or letters horizontally while the surrounding text flows vertically. This technique is commonly called tate-chu-yoko.
The property works with writing-mode and is useful for dates, numbers, abbreviations, and other short character sequences that should remain horizontally readable within vertical text.
text-combine-upright Syntax
The text-combine-upright property accepts the keywords none, all, and the defined but less widely implemented digits value.
Basic Syntax
.vertical-number {
text-combine-upright: all;
}
This combines the characters inside the element into one upright typographic unit when used in a vertical writing mode.
Available Values
.example {
text-combine-upright: none;
}
.example {
text-combine-upright: all;
}
.example {
text-combine-upright: digits 2;
}
.example {
text-combine-upright: digits 4;
}
The digits syntax is defined for automatically combining groups of digits, but browser support is limited. The all value is generally the practical choice for explicitly marked character sequences.
CSS-Wide Keywords
.example {
text-combine-upright: initial;
}
.example {
text-combine-upright: inherit;
}
.example {
text-combine-upright: unset;
}
.example {
text-combine-upright: revert;
}
.example {
text-combine-upright: revert-layer;
}
The initial value is none. The property is not inherited.
Using It With Vertical Writing
.vertical-text {
writing-mode: vertical-rl;
}
.vertical-text .number {
text-combine-upright: all;
}
The parent establishes vertical text flow, while the nested element combines its characters into an upright unit.
Property Values
| Value | Description |
|---|---|
none |
Does not combine characters into an upright unit. This is the initial value. |
all |
Combines the element's characters into a single upright typographic unit in vertical writing. |
digits 2 |
Defines automatic combination of sequences of up to two consecutive digits. Browser implementation is limited. |
digits 3 |
Defines automatic combination of sequences of up to three consecutive digits. Browser implementation is limited. |
digits 4 |
Defines automatic combination of sequences of up to four consecutive digits. Browser implementation is limited. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | none |
| Inherited | No |
| Applies to | Non-replaced inline elements |
| Computed value | As specified |
| Animation type | Discrete |
| Percentages | Not accepted |
| Related properties | writing-mode, text-orientation, direction |
| Specification | CSS Writing Modes Level 4 |
Valid Examples
.number {
text-combine-upright: none;
}
.number {
text-combine-upright: all;
}
.number {
text-combine-upright: digits 2;
}
.number {
text-combine-upright: digits 3;
}
.number {
text-combine-upright: digits 4;
}
Invalid Examples
.number {
text-combine-upright: upright;
}
.number {
text-combine-upright: horizontal;
}
.number {
text-combine-upright: digits 5;
}
.number {
text-combine-upright: 50%;
}
.number {
text-combine-upright: 20px;
}
The property does not accept arbitrary lengths, percentages, or orientation keywords. The defined digits syntax limits the optional integer to values from 2 through 4.
How It Works
In vertical writing, text progresses along a vertical inline axis. Depending on the writing system and text-orientation, individual characters may appear upright or rotated.
The text-combine-upright property allows a short sequence to be typeset horizontally within that vertical flow.
Step 1: Create Vertical Text
<p class="vertical-example">
令和8年11月21日
</p>
Step 2: Establish the Writing Mode
.vertical-example {
writing-mode: vertical-rl;
text-orientation: mixed;
}
The text flows vertically, with orientation determined by the characters and writing-mode rules.
Step 3: Mark the Characters to Combine
<p class="vertical-example">
令和<span class="combined-number">8</span>年
<span class="combined-number">11</span>月
<span class="combined-number">21</span>日
</p>
Step 4: Enable Character Combination
.combined-number {
text-combine-upright: all;
}
Each marked sequence is combined into an upright unit within the vertical line.
Step 5: Adjust the Sequences
Short sequences generally fit more comfortably into a single typographic unit. Longer sequences may be compressed significantly and become difficult to read.
Important Consideration
The property affects typographic layout, not the underlying characters. The text remains in its original logical order.
The none Value
The none value disables character combination. Characters follow the normal orientation and layout rules of the writing mode.
Syntax
.number {
text-combine-upright: none;
}
Example
<p class="vertical-text">
番号<span class="number">12</span>
</p>
.vertical-text {
writing-mode: vertical-rl;
}
.number {
text-combine-upright: none;
}
The digits follow the normal orientation behavior for the vertical writing mode rather than being combined into one upright unit.
When to Use none
Use none when normal vertical typography is preferred or when a previously applied combination should be disabled.
The all Value
The all value combines the characters of an inline element into a single upright typographic unit within vertical text.
This is the most practical and widely implemented value for tate-chu-yoko.
Syntax
.number {
text-combine-upright: all;
}
Example
<p class="vertical-text">
第<span class="number">12</span>章
</p>
.vertical-text {
writing-mode: vertical-rl;
}
.number {
text-combine-upright: all;
}
The two digits are displayed together as one upright unit within the vertical text.
Combining Letters
<p class="vertical-text">
<span class="short-label">CSS</span>入門
</p>
.short-label {
text-combine-upright: all;
}
The letters CSS are combined horizontally into one upright unit.
Long Character Sequences
.long-number {
text-combine-upright: all;
}
The browser may compress the characters to fit the available typographic space. Avoid combining long strings that become difficult to read.
When to Use all
Use all for explicitly marked dates, short numbers, abbreviations, and similar character groups in vertical writing.
The digits Value
The digits value is defined to automatically combine short sequences of consecutive digits in vertical text.
Unlike all, which combines the contents of an explicitly selected inline element, digits describes automatic grouping behavior.
Syntax
.vertical-text {
text-combine-upright: digits 2;
}
Available Forms
.vertical-text {
text-combine-upright: digits 2;
}
.vertical-text {
text-combine-upright: digits 3;
}
.vertical-text {
text-combine-upright: digits 4;
}
The integer defines the maximum number of consecutive digits that can be combined into a single upright unit.
Example
<p class="vertical-text">
令和8年11月21日
</p>
.vertical-text {
writing-mode: vertical-rl;
text-combine-upright: digits 2;
}
Under the defined behavior, eligible sequences of up to two digits can be combined automatically.
Browser Support Limitation
The digits value is not broadly implemented. Some browsers that support text-combine-upright: all do not support the automatic digit-grouping syntax.
Recommended Alternative
<p class="vertical-text">
令和8年<span class="number">11</span>月
<span class="number">21</span>日
</p>
.vertical-text {
writing-mode: vertical-rl;
}
.number {
text-combine-upright: all;
}
Explicitly wrapping the sequences and applying all provides a more reliable approach in browsers that implement character combination.
Working With writing-mode
The writing-mode property determines the direction in which lines of text are arranged. Character combination is designed for vertical writing modes.
Vertical Right-to-Left
.vertical-rl {
writing-mode: vertical-rl;
}
.vertical-rl .number {
text-combine-upright: all;
}
Text progresses vertically, and successive lines are arranged from right to left.
Vertical Left-to-Right
.vertical-lr {
writing-mode: vertical-lr;
}
.vertical-lr .number {
text-combine-upright: all;
}
Text progresses vertically, and successive lines are arranged from left to right.
Horizontal Writing
.horizontal {
writing-mode: horizontal-tb;
}
.horizontal .number {
text-combine-upright: all;
}
The character-combination effect is intended for vertical writing and does not provide the same layout behavior in ordinary horizontal text.
Choosing a Writing Mode
Use the writing mode appropriate for the language and document. Do not switch an entire section to vertical writing solely to rotate a small label when a simpler layout method would be more appropriate.
Relationship With text-orientation
The text-orientation property controls the orientation of individual characters in vertical writing, while text-combine-upright combines multiple characters into one upright unit.
| Property | Purpose |
|---|---|
writing-mode |
Establishes horizontal or vertical text flow. |
text-orientation |
Controls how individual characters are oriented within vertical text. |
text-combine-upright |
Combines multiple characters into a single upright typographic unit. |
Using text-orientation
.vertical-text {
writing-mode: vertical-rl;
text-orientation: mixed;
}
The mixed value allows character orientation to follow the normal rules for the writing system.
Adding Character Combination
.vertical-text {
writing-mode: vertical-rl;
text-orientation: mixed;
}
.vertical-text .number {
text-combine-upright: all;
}
The selected number is combined into a horizontal unit while the surrounding text continues to follow the vertical writing mode.
Using upright Orientation
.vertical-text {
writing-mode: vertical-rl;
text-orientation: upright;
}
The upright value keeps individual characters upright. It does not combine a sequence of characters into a single unit.
Important Difference
Use text-orientation to control individual glyph orientation and text-combine-upright to combine a selected sequence.
Layout Behavior
Combined characters are treated as a single typographic unit within the vertical line. This can affect spacing, alignment, and the amount of space occupied by the sequence.
Inline Formatting
The property is designed for inline content. Apply it to an inline element such as a <span> surrounding the characters to combine.
Character Compression
When a sequence is wider than the available upright unit, the browser may compress or scale the combined text according to the writing-mode rules.
Short Sequences
Two-digit numbers are common candidates because they can often remain legible when combined into a single vertical typographic unit.
Long Sequences
Combining long words or numbers can make the characters too small or tightly packed. Use shorter groups when possible.
Font Differences
Font design and available glyph metrics influence the appearance of combined text. Test the result with the actual font used by the page.
Responsive Layouts
Changes in font size and container dimensions may affect the appearance of combined characters. Verify readability at different viewport sizes.
Logical Text Order
The underlying text remains in its original logical order. The property changes its visual arrangement within the vertical line.
Practical Examples
Two-Digit Number
<p class="vertical-text">
第<span class="number">12</span>章
</p>
.vertical-text {
writing-mode: vertical-rl;
}
.number {
text-combine-upright: all;
}
Displays the two digits together as one upright unit.
Vertical Date
<p class="vertical-date">
令和8年<span>11</span>月<span>21</span>日
</p>
.vertical-date {
writing-mode: vertical-rl;
}
.vertical-date span {
text-combine-upright: all;
}
Combines the month and day numbers within the vertical date.
Short Abbreviation
<p class="vertical-label">
<span>CSS</span>入門
</p>
.vertical-label {
writing-mode: vertical-rl;
}
.vertical-label span {
text-combine-upright: all;
}
Combines the letters CSS horizontally within the vertical text.
Multiple Combined Numbers
<p class="vertical-text">
<span class="number">12</span>月
<span class="number">25</span>日
</p>
.vertical-text {
writing-mode: vertical-rl;
}
.number {
text-combine-upright: all;
}
Each marked number is combined independently.
Vertical Navigation Label
<nav class="vertical-navigation" aria-label="Section navigation">
<a href="#section-12">第<span>12</span>章</a>
</nav>
.vertical-navigation {
writing-mode: vertical-rl;
}
.vertical-navigation span {
text-combine-upright: all;
}
Maintains a compact number within a vertically arranged navigation label.
Vertical Left-to-Right Text
.vertical-label {
writing-mode: vertical-lr;
}
.vertical-label .number {
text-combine-upright: all;
}
Character combination can also be used with vertical left-to-right writing.
Reset Character Combination
.normal-number {
text-combine-upright: none;
}
Returns the selected element to normal character orientation behavior.
Progressive Enhancement
.vertical-text {
writing-mode: vertical-rl;
}
@supports (text-combine-upright: all) {
.vertical-text .number {
text-combine-upright: all;
}
}
Applies character combination only when the browser recognizes the declaration.
text-combine-upright Example
This example compares normal vertical text with a two-digit number that uses text-combine-upright: all. Both samples use the same writing mode and font size.
HTML Example
<div class="combine-demo">
<div class="combine-panel">
<h4>Without Combination</h4>
<p class="vertical-sample">
第<span class="normal-number">12</span>章
</p>
</div>
<div class="combine-panel">
<h4>With Combination</h4>
<p class="vertical-sample">
第<span class="combined-number">12</span>章
</p>
</div>
</div>
CSS Example
.combine-demo {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.combine-demo .combine-panel {
padding: 16px;
border: 1px solid #cbd5e1;
background: #f8fafc;
}
.combine-demo h4 {
margin: 0 0 16px;
font-size: 14px;
}
.combine-demo .vertical-sample {
display: block;
width: max-content;
height: 180px;
margin: 0 auto;
padding: 12px;
border: 1px solid #93c5fd;
background: #dbeafe;
writing-mode: vertical-rl;
text-orientation: mixed;
font-size: 28px;
line-height: 1.5;
}
.combine-demo .normal-number {
text-combine-upright: none;
}
.combine-demo .combined-number {
text-combine-upright: all;
}
Without Combination
第12章
With Combination
第12章
In supporting browsers, the first sample follows the normal orientation rules for the digits, while the second combines the digits into one upright horizontal unit.
Comparing the Results
| Setting | Behavior |
|---|---|
none |
Characters follow normal vertical text orientation rules. |
all |
The selected characters form one upright typographic unit. |
Combining Three Characters
<span class="combined-number">123</span>
Three characters can also be combined, although they may appear more compressed than a two-character sequence.
Changing the Writing Mode
.combine-demo .vertical-sample {
writing-mode: vertical-lr;
}
The vertical line progression changes, but the combined characters remain an upright unit.
Testing Browser Support
@supports (text-combine-upright: all) {
.combine-demo .combined-number {
text-combine-upright: all;
}
}
The feature query checks whether the browser recognizes the all value.
Accessibility Considerations
Character combination changes the visual arrangement of text, but the content should remain readable and understandable.
Preserve Logical Text Order
Keep the characters in their natural reading order in the HTML. Do not rearrange characters solely to imitate a vertical layout.
Use Appropriate Language Markup
<p lang="ja" class="vertical-text">
第<span class="number">12</span>章
</p>
The lang attribute identifies the language and helps assistive technologies interpret the text correctly.
Avoid Overly Compressed Text
Long combined sequences can become difficult to read. Prefer short numbers and abbreviations.
Support Text Resizing
Test combined characters when users enlarge text or increase browser zoom. Ensure the sequence remains legible.
Maintain Sufficient Contrast
Combined characters should meet the same text contrast requirements as surrounding content.
Test Font Fallbacks
Different fonts can produce different character widths and compression results.
Use Semantic HTML
Use appropriate elements for headings, paragraphs, and navigation. A <span> is suitable for marking a short sequence without changing its meaning.
Check Assistive Technology
The property changes visual presentation rather than the underlying text. Test important content with screen readers and other assistive technologies.
Common Mistakes
Using the Property Without Vertical Writing
.number {
text-combine-upright: all;
}
The intended character-combination effect requires an appropriate vertical writing context.
Applying all to an Entire Paragraph
.vertical-paragraph {
text-combine-upright: all;
}
Applying all to a long sequence is not an appropriate way to format an entire vertical paragraph. Wrap only the characters that should be combined.
Confusing text-combine-upright With text-orientation
The text-orientation property controls individual character orientation. The text-combine-upright property combines a sequence into one typographic unit.
Assuming digits Has Universal Support
.vertical-text {
text-combine-upright: digits 2;
}
The automatic digits syntax is not broadly supported. Use explicitly marked sequences with all when compatibility is important.
Using an Invalid Digit Count
.vertical-text {
text-combine-upright: digits 5;
}
The defined digits syntax permits only values from 2 through 4.
Using Unsupported Keywords
.number {
text-combine-upright: horizontal;
}
The property does not accept horizontal or upright as values.
Combining Too Many Characters
Long strings can become heavily compressed. Use short sequences for better readability.
Ignoring Writing Direction
The surrounding writing mode determines the direction of vertical text flow. Character combination does not replace writing-mode.
Assuming the Property Is Inherited
The property is not inherited. Apply it directly to the inline element containing the characters to combine.
Ignoring Font Differences
Fonts have different character widths and metrics. Test the appearance with the intended font family.
Ignoring Browser Support
Unsupported browsers ignore the declaration. Ensure the text remains understandable without character combination.
Expecting Smooth Animation
The property uses discrete animation behavior. Changes between values do not interpolate smoothly.
Important Considerations
Keep the following points in mind when using text-combine-upright:
- It combines characters into an upright typographic unit within vertical text.
- It is primarily intended for East Asian vertical typography.
- The technique is commonly called tate-chu-yoko.
- The initial value is
none. - The property is not inherited.
- The
nonevalue disables character combination. - The
allvalue combines the selected inline sequence. - The
digitssyntax defines automatic combination of short digit sequences. - The defined digit counts range from 2 through 4.
- The
digitssyntax has limited browser implementation. - The
allvalue is generally more practical for explicitly marked sequences. - The property is designed for vertical writing modes.
- It works with
writing-mode: vertical-rlandvertical-lr. - It does not replace
writing-mode. - It differs from
text-orientation. - It does not change the underlying character order.
- It is useful for short numbers, dates, and abbreviations.
- Long sequences may become compressed and difficult to read.
- It is best applied to short inline elements such as
<span>. - Font metrics influence the appearance of combined characters.
- Font fallbacks may produce different results.
- The property does not accept lengths or percentages.
- It does not accept arbitrary orientation keywords.
- It uses discrete animation behavior.
- Browser support varies by value and browser version.
- Feature queries can be used for progressive enhancement.
- Test text resizing, font fallback, and responsive layouts.
- Use appropriate language markup for multilingual content.
- Keep the text readable when character combination is unsupported.
Browser Support
The CSS text-combine-upright property is supported in modern browsers for common vertical-text character combination using the all value. Support for the digits syntax is more limited.
Browsers that do not recognize a value ignore the declaration. For the broadest practical compatibility, explicitly wrap short character sequences and apply text-combine-upright: all.
For current compatibility information, visit Can I Use? and search for text-combine-upright.
Feature Detection
@supports (text-combine-upright: all) {
.vertical-text .number {
text-combine-upright: all;
}
}
This checks whether the browser recognizes the all value.
Checking the digits Value
@supports (text-combine-upright: digits 2) {
.vertical-text {
text-combine-upright: digits 2;
}
}
This checks whether the browser recognizes the automatic digit-combination syntax. Recognition of a declaration does not guarantee identical rendering in every browser.
Fallback Behavior
.vertical-text {
writing-mode: vertical-rl;
text-orientation: mixed;
}
@supports (text-combine-upright: all) {
.vertical-text .number {
text-combine-upright: all;
}
}
Without support, the characters remain part of the vertical text and follow normal orientation rules.
Testing Recommendations
Test the property with two-digit and three-digit sequences, different fonts, both vertical writing modes, and browser zoom. Confirm that combined characters remain legible.
Specifications
The text-combine-upright property is defined in the CSS Writing Modes Level 4 specification.
CSS Writing Modes Level 4 - text-combine-upright Property
The specification defines the supported values, character-combination behavior, and interaction with vertical writing modes.
For additional documentation and examples, consult MDN Web Docs.
