CSS text-orientation Property

The CSS text-orientation property controls how individual characters are oriented within vertical writing modes.

It determines whether characters remain upright or are rotated sideways as text flows vertically. The property is especially useful for East Asian typography, vertical labels, and layouts containing a mixture of Latin letters, numbers, and other characters.

The text-orientation property works with writing-mode. It does not make text vertical by itself.

text-orientation Syntax

The property accepts a single keyword that determines how characters are displayed within a vertical writing mode.

Basic Syntax

.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

Available Values

.example {
  text-orientation: mixed;
}
.example {
  text-orientation: upright;
}
.example {
  text-orientation: sideways;
}

CSS-Wide Keywords

.example {
  text-orientation: initial;
}
.example {
  text-orientation: inherit;
}
.example {
  text-orientation: unset;
}
.example {
  text-orientation: revert;
}
.example {
  text-orientation: revert-layer;
}

The initial value is mixed. Because the property is inherited, unset behaves like inherit.

Valid Examples

.example {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.example {
  writing-mode: vertical-lr;
  text-orientation: upright;
}
.example {
  writing-mode: vertical-rl;
  text-orientation: sideways;
}

Invalid Examples

.example {
  text-orientation: vertical;
}
.example {
  text-orientation: rotate(90deg);
}
.example {
  text-orientation: 90deg;
}
.example {
  text-orientation: mixed upright;
}

The property does not accept rotation angles, transform functions, or multiple orientation keywords.

Property Values

Value Description
mixed Uses the natural vertical orientation of characters. Characters such as many East Asian ideographs remain upright, while characters with a sideways orientation, such as Latin letters, are rotated.
upright Displays typographic characters upright in vertical writing, including Latin letters and numbers.
sideways Displays text sideways within the vertical line, with the rotation direction determined by the writing mode.

Property Characteristics

Characteristic Value
Initial value mixed
Inherited Yes
Applies to All elements except table row groups, rows, column groups, and columns
Computed value Specified keyword
Animation type Discrete
Percentages Not applicable
Lengths Not accepted
Specification CSS Writing Modes Level 3

Note: The property primarily affects text in vertical writing modes. Setting it on ordinary horizontal text does not make the text vertical.

How It Works

The text-orientation property determines the orientation of characters after a vertical writing mode has been established.

Step 1: Create a Text Element

<p class="vertical-label">Vertical Text 2026</p>

Step 2: Enable Vertical Writing

.vertical-label {
  writing-mode: vertical-rl;
}

The text flows vertically, with successive lines progressing from right to left.

Step 3: Set Character Orientation

.vertical-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

The characters are displayed upright instead of using the default mixture of upright and sideways orientations.

Step 4: Compare Mixed Orientation

.vertical-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

Characters follow their normal vertical orientation rules. Latin text generally appears sideways, while many East Asian characters remain upright.

Step 5: Display Text Sideways

.vertical-label {
  writing-mode: vertical-rl;
  text-orientation: sideways;
}

The text is displayed sideways within the vertical line.

Important Consideration

Character orientation and line progression are separate concepts. Use writing-mode to control the writing direction and text-orientation to control character orientation.

The mixed Value

The mixed value uses the default orientation rules for characters in vertical writing.

Basic Example

.mixed-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

Latin Text

<p class="mixed-text">Web Design</p>

Latin letters generally rotate sideways as a group within the vertical line.

Japanese Text

<p class="mixed-text" lang="ja">縦書きの文章です。</p>

Many Japanese characters remain upright in vertical writing.

Mixed Writing Systems

<p class="mixed-text" lang="ja">CSSで縦書きを設定します。</p>

The browser applies the appropriate orientation to each character or text run according to vertical typography rules.

When to Use mixed

Use mixed for conventional vertical typography containing multiple writing systems. It is also the default value.

The upright Value

The upright value keeps characters upright in vertical writing, including characters that would normally rotate sideways.

Basic Example

.upright-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

Upright Latin Letters

<p class="upright-text">HTML CSS</p>

Latin letters appear individually upright along the vertical line.

Upright Numbers

<p class="upright-text">2026</p>

Each digit is displayed upright rather than rotated sideways.

Vertical Navigation Labels

.vertical-navigation-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.15em;
}

This can be useful for short decorative labels or compact navigation text, provided the result remains readable.

Direction Behavior

When upright is used, the used value of direction is treated as ltr for text orientation purposes. This is important when working with bidirectional text.

Important Consideration

Upright orientation can make longer Latin words difficult to read because letters are stacked vertically. It is generally more suitable for short labels than long passages of Latin text.

The sideways Value

The sideways value displays text sideways within the vertical line, rather than keeping individual characters upright.

Basic Example

.sideways-text {
  writing-mode: vertical-rl;
  text-orientation: sideways;
}

Sideways Latin Text

<p class="sideways-text">Web Design</p>

The text appears rotated within the vertical writing direction.

Sideways Numbers

<p class="sideways-text">2026</p>

The digits follow the sideways text orientation rather than appearing as individually upright characters.

Using vertical-lr

.sideways-text {
  writing-mode: vertical-lr;
  text-orientation: sideways;
}

The sideways rotation follows the opposite orientation from vertical-rl.

Sideways vs. transform

.rotated-element {
  transform: rotate(90deg);
}

The transform property rotates an element visually without changing its normal document layout dimensions. By contrast, vertical writing modes and text-orientation participate in text layout.

When to Use sideways

Use sideways for vertical labels, headings, or other text that should retain a sideways reading orientation.

Working With writing-mode

The writing-mode property establishes the direction of text flow and line progression. The text-orientation property determines how characters appear within that flow.

Horizontal Writing

.horizontal-text {
  writing-mode: horizontal-tb;
  text-orientation: upright;
}

The text remains horizontal. The text-orientation declaration does not turn it into vertical text.

Vertical Right-to-Left Line Progression

.vertical-right {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

Text flows vertically, and successive lines progress from right to left.

Vertical Left-to-Right Line Progression

.vertical-left {
  writing-mode: vertical-lr;
  text-orientation: upright;
}

Text flows vertically, and successive lines progress from left to right.

Comparing Writing Modes

writing-mode Behavior
horizontal-tb Horizontal text with lines progressing from top to bottom.
vertical-rl Vertical text with lines progressing from right to left.
vertical-lr Vertical text with lines progressing from left to right.

Important Consideration

Choose the writing mode first, then select the character orientation that best suits the content.

Working With text-combine-upright

The text-combine-upright property can combine a short sequence of characters into a single upright unit within vertical writing.

Combining Digits

<p class="vertical-date" lang="ja">
  令和<span class="combined-digits">08</span>年
</p>
.vertical-date {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.combined-digits {
  text-combine-upright: all;
}

The two digits can appear together as one upright unit rather than following the normal sideways orientation.

Upright Characters vs. Combined Characters

.individual-digits {
  text-orientation: upright;
}
.combined-digits {
  text-combine-upright: all;
}

The first declaration controls the orientation of individual characters. The second combines a short text run into a single upright unit.

When to Use text-combine-upright

It is useful for short numbers, dates, and other compact sequences in East Asian vertical typography.

Important Consideration

Combining long text runs can make characters too small or difficult to read. Keep combined content short and test its appearance.

Language Considerations

Character orientation is closely related to the writing system used by the text.

Japanese Vertical Text

.japanese-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

Mixed orientation is commonly suitable for Japanese vertical typography because it preserves the normal upright orientation of many Japanese characters.

Chinese Vertical Text

.chinese-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

Many Chinese characters remain upright in vertical writing.

Latin Labels

.latin-label {
  writing-mode: vertical-rl;
  text-orientation: sideways;
}

Sideways orientation can preserve the familiar reading arrangement of Latin words.

Stacked Latin Characters

.stacked-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

Upright orientation stacks Latin letters individually and may be appropriate for short labels.

Language Attributes

<p lang="ja" class="japanese-vertical">縦書きの例です。</p>
<p lang="zh" class="chinese-vertical">這是直排文字的範例。</p>

Use appropriate lang attributes to identify the language and support correct text rendering.

Important Consideration

Character orientation does not replace language-specific typography rules. Fonts, punctuation, and writing-system conventions also influence vertical text rendering.

Inheritance

The text-orientation property is inherited. Descendant elements normally use the orientation specified by their parent unless they override it.

Inherited Orientation

.vertical-container {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

Text inside the container inherits the upright orientation.

Overriding Orientation

.vertical-container {
  writing-mode: vertical-rl;
  text-orientation: upright;
}
.vertical-container .sideways-label {
  text-orientation: sideways;
}

Explicit Inheritance

.child {
  text-orientation: inherit;
}

Restoring the Initial Value

.child {
  text-orientation: initial;
}

This restores mixed.

Using unset

.child {
  text-orientation: unset;
}

Because the property is inherited, unset uses the parent's computed value.

Important Consideration

Inherited orientation only produces the expected vertical appearance when the text is displayed in an appropriate writing mode.

Practical Examples

Default Vertical Orientation

.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

Upright Vertical Label

.vertical-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

Sideways Vertical Heading

.vertical-heading {
  writing-mode: vertical-rl;
  text-orientation: sideways;
}

Vertical Japanese Text

.japanese-content {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  line-height: 1.8;
}

Vertical Left-to-Right Layout

.vertical-left {
  writing-mode: vertical-lr;
  text-orientation: upright;
}

Short Navigation Label

.navigation-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.1em;
}

Sideways Section Label

.section-label {
  writing-mode: vertical-rl;
  text-orientation: sideways;
  font-weight: bold;
}

Responsive Vertical Text

.responsive-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
@media (max-width: 600px) {
  .responsive-label {
    writing-mode: horizontal-tb;
  }
}

This switches the label back to horizontal writing on narrower screens.

Combined Digits in Vertical Text

.vertical-number {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.vertical-number span {
  text-combine-upright: all;
}

Feature Detection

@supports (text-orientation: upright) {
  .vertical-label {
    writing-mode: vertical-rl;
    text-orientation: upright;
  }
}

The rule applies only when the browser recognizes the requested orientation value.

text-orientation Example

This example compares the mixed, upright, and sideways values using the same vertical text. Each sample uses writing-mode: vertical-rl so the character orientation differences are visible.

HTML Example

<div class="text-orientation-demo">
  <div class="orientation-sample">
    <strong>mixed</strong>
    <p class="orientation-mixed">CSS 2026 日本語</p>
  </div>
  <div class="orientation-sample">
    <strong>upright</strong>
    <p class="orientation-upright">CSS 2026 日本語</p>
  </div>
  <div class="orientation-sample">
    <strong>sideways</strong>
    <p class="orientation-sideways">CSS 2026 日本語</p>
  </div>
</div>

CSS Example

.text-orientation-demo {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.text-orientation-demo .orientation-sample {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 250px;
  padding: 16px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}
.text-orientation-demo strong {
  display: block;
  margin-bottom: 16px;
  color: #334155;
  font-size: 14px;
}
.text-orientation-demo p {
  margin: 0;
  height: 175px;
  color: #1f2937;
  font-size: 20px;
  line-height: 1.5;
  writing-mode: vertical-rl;
}
.text-orientation-demo .orientation-mixed {
  text-orientation: mixed;
}
.text-orientation-demo .orientation-upright {
  text-orientation: upright;
}
.text-orientation-demo .orientation-sideways {
  text-orientation: sideways;
}
Browser Result
mixed

CSS 2026 日本語

upright

CSS 2026 日本語

sideways

CSS 2026 日本語

Comparing the Results

Value Expected Appearance
mixed Latin letters and numbers generally appear sideways, while Japanese characters remain upright.
upright Latin letters, numbers, and Japanese characters are displayed upright.
sideways The text follows a sideways orientation within the vertical line.

Changing the Writing Mode

.text-orientation-demo p {
  writing-mode: vertical-lr;
}

The text continues vertically, but line progression changes to left-to-right and the sideways rotation direction changes.

Returning to Horizontal Writing

.text-orientation-demo p {
  writing-mode: horizontal-tb;
}

The text returns to horizontal writing, so the orientation differences no longer produce the same vertical appearance.

Increasing Character Spacing

.text-orientation-demo .orientation-upright {
  letter-spacing: 0.15em;
}

This adds space between the upright characters.

Accessibility Considerations

Vertical text can be useful for certain writing systems and compact labels, but it should be applied carefully to preserve readability and usability.

Use Appropriate Writing Modes

Vertical writing is most suitable when it matches the content's language or design purpose.

Avoid Long Stacked Latin Text

Displaying long Latin words with upright can make them difficult to read.

Maintain Readable Font Sizes

Ensure that vertically oriented characters remain legible at different zoom levels.

Test Responsive Layouts

Vertical text can require additional height and may overflow short containers.

Preserve Logical Reading Order

Use normal HTML text rather than placing individual characters in separate elements solely to create a vertical appearance.

Use Language Attributes

Identify the language of the content so browsers and assistive technologies can interpret it correctly.

Avoid Unnecessary Rotation

Decorative vertical labels should not replace clear horizontal navigation or essential instructions when readability would suffer.

Check Interactive Elements

If vertical text is used inside buttons or navigation links, confirm that the text remains readable and the controls are easy to use.

Test With Assistive Technology

Verify that vertical text retains a sensible reading order and accessible name.

Common Mistakes

Expecting text-orientation to Create Vertical Text

.example {
  text-orientation: upright;
}

Without a vertical writing mode, this does not create vertical text.

Correct Combination

.example {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

Using vertical as a Value

.example {
  text-orientation: vertical;
}

The vertical keyword is not a valid value.

Using Rotation Angles

.example {
  text-orientation: 90deg;
}

The property accepts keywords rather than angles.

Using Transform Functions

.example {
  text-orientation: rotate(90deg);
}

Use transform for visual element rotation.

Combining Multiple Values

.example {
  text-orientation: mixed upright;
}

Only one orientation keyword can be specified.

Confusing mixed and upright

The mixed value follows the normal vertical orientation rules for different characters. The upright value keeps characters upright.

Confusing sideways and transform

Sideways text orientation participates in vertical text layout, while transforms rotate an element visually.

Using upright for Long Latin Paragraphs

Long passages of individually upright Latin letters are often difficult to read.

Ignoring Container Height

Vertical text may require more height than expected, particularly when characters are stacked individually.

Ignoring Language Conventions

Different writing systems have different expectations for vertical text and punctuation.

Overlooking Inheritance

Descendant elements inherit the orientation value unless it is overridden.

Important Considerations

Keep the following points in mind when using text-orientation:

  • The property controls character orientation in vertical writing.
  • It does not enable vertical writing by itself.
  • Use writing-mode to establish vertical text flow.
  • The initial value is mixed.
  • The property is inherited.
  • The standard values are mixed, upright, and sideways.
  • The mixed value follows normal vertical orientation rules.
  • The upright value keeps typographic characters upright.
  • The sideways value displays text sideways within the vertical line.
  • Only one orientation keyword can be specified.
  • Lengths, percentages, and rotation angles are not accepted.
  • The property primarily affects vertical writing modes.
  • The vertical-rl writing mode progresses lines from right to left.
  • The vertical-lr writing mode progresses lines from left to right.
  • The sideways rotation direction depends on the writing mode.
  • Many East Asian characters remain upright with mixed.
  • Latin letters commonly appear sideways with mixed.
  • Upright Latin letters are displayed individually along the vertical line.
  • Long upright Latin passages can be difficult to read.
  • The text-combine-upright property can combine short character sequences.
  • Vertical typography depends on font and writing-system support.
  • Language attributes help identify the intended writing system.
  • Vertical text may require additional container height.
  • Transforms and text orientation affect layout differently.
  • Test vertical text at different viewport sizes and zoom levels.

Browser Support

The CSS text-orientation property is widely available in modern browsers, including Chrome, Edge, Firefox, and Safari. The standard mixed, upright, and sideways values are supported in current major browser versions.

Older browsers may have incomplete support for vertical writing or particular character orientation behaviors.

For current compatibility information, visit Can I Use? and search for text-orientation.

Standard Example

.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

This is a standard combination for vertical text using the default character orientation rules.

Upright Text

.vertical-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

Feature Detection

@supports (writing-mode: vertical-rl) and (text-orientation: upright) {
  .vertical-label {
    writing-mode: vertical-rl;
    text-orientation: upright;
  }
}

The rule applies only when the browser recognizes both declarations.

Horizontal Fallback

.vertical-label {
  writing-mode: horizontal-tb;
}
@supports (writing-mode: vertical-rl) and (text-orientation: upright) {
  .vertical-label {
    writing-mode: vertical-rl;
    text-orientation: upright;
  }
}

Browsers without support for the requested vertical writing features retain horizontal text.

Testing Recommendations

Test Latin letters, numbers, East Asian characters, punctuation, and mixed-language text. Check that the selected font renders vertical characters correctly.

Specifications

The text-orientation property is defined in the CSS Writing Modes Level 3 specification.

CSS Writing Modes Level 3 - text-orientation Property

The specification defines the orientation of characters in vertical writing and the behavior of the mixed, upright, and sideways values.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: text-orientation