The writing-mode property sets whether lines of text are laid out horizontally or vertically, and which way block lines stack. It defines the block flow direction and how inline content flows inside a block.
The property is inherited. The initial value is horizontal-tb. For a whole document, set it on the root (html). Pair with direction and text-orientation for finer control.
Baseline widely available.
Core values (horizontal-tb, vertical-rl, vertical-lr) are widely supported. sideways-rl / sideways-lr have limited support. Old SVG keywords like lr, tb, and rl are deprecated for CSS — use the modern keywords instead.
Next line goes right. Compared with Example 2, the block progression flips.
Same height tip. A fixed height makes the sideways stack easy to see.
Pick by language need. Choose rl or lr to match the script’s traditional line order.
Edge Cases & Pitfalls
Most surprises come from limited sideways support or mixing physical vs logical CSS.
deprecated
Avoid old SVG keywords in CSS
lr, rl, tb, lr-tb, tb-rl, and similar are deprecated for CSS (SVG1 only). Use horizontal-tb, vertical-rl, or vertical-lr.
limited
sideways-* support varies
sideways-rl and sideways-lr are not as widely available as the core three values. Provide a vertical fallback when they matter.
logical
Physical edges change meaning
margin-top is still physical top. Prefer block-size / inline-size and logical margins when layouts must follow the writing mode.
height
Vertical demos need vertical space
Without a height (or enough content), vertical modes can look cramped. Set a height when studying line stacking.
orientation
Latin in vertical modes
Latin glyphs may rotate. Use text-orientation to keep them upright or sideways as needed.
Compatibility
Browser Support
writing-mode is a browser CSS property for text layout. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
writing-mode
horizontal-tb, vertical-rl, and vertical-lr are widely supported. sideways-rl and sideways-lr have limited support. Deprecated SVG keywords should not be used in modern CSS.
97%Core values
Google ChromeSupported
Full support (core)
Mozilla FirefoxSupported
Full support (core)
Apple SafariSupported
Full support (core)
Microsoft EdgeSupported
Full support (core)
OperaSupported
Full support (core)
Samsung InternetSupported
Full support (core)
Internet ExplorerPartial
Older prefixes / limited
writing-modeBaseline · Core values
Bottom line: Safe to use for horizontal and vertical layouts. Treat sideways values as progressive enhancement. This is not a JavaScript runtime API.
Remember
Key Takeaways
Role: choose horizontal or vertical text flow and how lines stack.
Initial:horizontal-tb. Inherited. Set on html for a whole page.
vertical-rl vs vertical-lr: next line left vs right.
Skip deprecated SVG names; treat sideways-* as limited.
One line:writing-mode flips the map of “block” and “inline” — start with horizontal-tb, then go vertical when the script needs it.
Frequently Asked Questions
It sets whether lines of text are laid out horizontally or vertically, and the direction in which block lines stack.
The initial value is horizontal-tb. Text flows horizontally, and the next line is placed below.
Both stack text in vertical lines. vertical-rl places the next line to the left (common for Japanese). vertical-lr places the next line to the right.
Set it on the root element (html for HTML documents) so the entire document uses that mode.
Support is limited compared with horizontal-tb, vertical-rl, and vertical-lr. Treat sideways values as progressive enhancement.
Yes. It applies to most elements (not table row/column groups) and is inherited. It is a browser CSS property, not a Node.js feature.