CSS3 Intermediate Modern Layout · 6 min read

CSS writing-mode for Vertical Labels

Lesson 35 of 41 in the CSS3 learning path.

How do I set a vertical spine label without rotating the whole card?

writing-mode: vertical-rl lays text top to bottom. The element’s width and height swap roles.

A rotated span is hard to size. writing-mode is the property made for a vertical tab.

Syntax & Parameters

Syntax
.spine { writing-mode: vertical-rl; }

Example

Interactive preview available
tabs.css
.spine {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: .75rem .4rem;
  background: #1d4ed8;
  color: white;
}
.card {
  display: flex;
  align-items: stretch;
}
.card .body {
  padding: 1rem;
}

Expected Output

A blue vertical label beside a horizontal card body. The letters read downward and stay upright.

Line-by-Line Walkthrough

  1. The spine is only the tab label.
  2. vertical-rl runs glyphs from top to bottom.
  3. text-orientation mixed keeps Latin letters upright.
  4. The card is a row so the spine sits beside the body.
  5. Padding is applied in the element’s own axes.
  6. The body stays horizontal.
  7. Do not set writing-mode on the whole page.
  8. A logical margin still follows the new block direction.

Common Pitfalls & Security

Read the limits before you copy this.

  • Putting writing-mode on body rotates the entire lesson.
  • rotate() and writing-mode together double the turn.
  • Width then means the vertical measure. Layout math surprises people.
  • Screen readers still read the text. Do not use this for text that should stay hidden.

Best Practices & Modern Standards

Use writing-mode for a real vertical label, not as a design trick on paragraphs.

Keep the rest of the card in horizontal writing mode.

Real-World Use

A course card has a vertical track name, PHP or SQL, beside the title. The title itself stays horizontal.

Frequently Asked Questions

Does this rotate letters?

vertical-rl with text-orientation mixed stacks upright letters downward.

What about horizontal-tb?

That is the normal left-to-right block flow.

Does flex still work?

Yes. The spine is one flex item. Its block axis is vertical.

Should body copy use it?

No. Long paragraphs become hard to read.

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share

Reactions

Loading reactions…