CSS
🎯 What is text-orientation?
The text-orientation property defines how text inside an HTML element is rotated or aligned when used with the writing-mode property.
In other words, it controls whether characters:
- Stand upright
- Appear sideways
- Or follow mixed alignment rules
This property is especially important for vertical writing modes used in:
- Japanese
- Chinese
- Other East Asian languages
- Vertical design layouts
🔹 Basic Usage
CSS
p {
writing-mode: vertical-rl;
text-orientation: upright;
}
➡️ In this example, the text flows vertically (right to left), and each character is displayed upright.
🔹 Values
1. mixed (Default)
The default behavior.
- Latin characters (like English) stay horizontal
- East Asian characters are displayed vertically
🧩 Example
HTML
<p style="writing-mode: vertical-rl; text-orientation: mixed;">
Hello 世界
</p>
📘 Explanation:
- “Hello” remains horizontal
- “世界” (Chinese characters) are displayed vertically
2. upright
Displays all characters upright in a vertical flow.
- Every character stands vertically
- Letters are stacked from top to bottom
🧩 Example
HTML
<p style="writing-mode: vertical-rl; text-orientation: upright;">
Hello World
</p>
📘 Explanation:
Each letter is displayed upright, one below the other in a vertical line.
3. initial
Resets the property to its default value ( mixed ).
🧩 Example
HTML
text-orientation: initial;
4. inherit
The element inherits the text-orientation value from its parent element.
🧩 Example
HTML
text-orientation: inherit;
💡 Summary Table
| Value | Description |
|---|---|
| mixed | Default: Latin text horizontal, East Asian text vertical |
| upright | All characters are displayed upright |
| initial | Resets to default value ( mixed ) |
| inherit | Inherits value from parent element |
🧠 Summary
- The text-orientation property controls how text behaves in vertical writing modes.
- Key Usage:
- upright → All characters stand vertically
- mixed → Latin letters stay horizontal, Asian characters become vertical
- This property is especially useful for:
- Vertical typography designs
- Japanese and Chinese layouts
- Creative UI text arrangements
- Magazine-style or artistic layouts
- When combined with writing-mode, it gives full control over vertical text presentation in CSS.
🧠 Summary
- The writing-mode property controls the text flow direction inside an element.
- Common Usage:
- For English, Turkish, and most Western languages → horizontal-tb
- For Japanese, Chinese, or vertical layouts → vertical-rl or vertical-lr
- This property is very useful when creating:
- Multilingual websites
- Vertical typography designs
- Creative UI layouts
- Magazine-style text sections
- Using writing-mode correctly helps create flexible and visually unique text layouts with pure CSS.
