CSS Reference ยท Typography
The text-orientation property
Reference for the CSS text-orientation property: set how characters are rotated in vertical writing modes with mixed, upright and sideways, with live examples.
The text-orientation property decides how characters are turned when text runs vertically. In a vertical writing mode, Latin letters can lie on their side (rotated), stand upright one above another, or follow the script's natural rule.
It only has an effect in vertical writing modes, such as writing-mode: vertical-rl. In ordinary horizontal text it does nothing.
.spine { writing-mode: vertical-rl; text-orientation: upright; }
Try it
In the first and third columns the Latin text is rotated 90 degrees clockwise. In the middle column each letter stands upright and the text reads from top to bottom, one character after another.
Syntax
text-orientation: mixed | upright | sideways
- Initial value:
mixed - Applies to: all elements except table row groups, rows, column groups and columns
- Inherited: yes
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
mixed |
Characters from scripts that are normally written vertically (such as Chinese or Japanese) stay upright; characters from horizontal scripts such as Latin are rotated sideways. |
upright |
All characters are set upright, including Latin letters. Text is also treated as left-to-right. |
sideways |
All characters are rotated sideways, as if the horizontal line had been turned 90 degrees. |
Usage notes
- Pair it with
writing-mode. Set a vertical mode first;text-orientationthen refines it. - Short labels only. Upright Latin text is slow to read. It suits short labels such as tab names or decorative words, not paragraphs.
- Rotated headings. For a rotated sidebar title in a Western site,
writing-mode: vertical-rlwith the defaultmixedis usually enough. - Different from transforms.
rotate()turns the whole box and its layout space stays horizontal; vertical writing modes reflow the text and the box. - Reading direction. Remember that
vertical-rlplaces new lines to the left, andvertical-lrplaces them to the right. - Legacy values. Older drafts had other keywords such as
sideways-right; use the three listed here.
Browser support
Supported in current versions of the major browsers, but the sideways value arrived later than mixed and upright, so check a compatibility table if you need it.
Related
writing-modeโ horizontal or vertical textdirectionโ inline text directionunicode-bidiโ bidirectional embedding- Lesson: Writing Modes