What CSS writing modes control
Writing modes generalise CSS layout beyond left-to-right horizontal text. The
writing-mode property sets which way blocks stack and lines flow, direction
sets right-to-left vs left-to-right inline progression, and text-orientation
rotates glyphs in vertical modes. Together they define the block axis and
inline axis that logical properties follow. This reference lists every value
with the axes it produces.
How it works
writing-mode establishes two axes. The block axis is the direction new lines
(blocks) advance; the inline axis is the direction characters within a line
advance. direction flips the inline axis for RTL scripts:
.cjk {
writing-mode: vertical-rl; /* lines run top→bottom, columns right→left */
text-orientation: mixed; /* CJK upright, Latin rotated */
}
.arabic {
direction: rtl; /* inline axis runs right→left */
}
/* logical property — follows the mode automatically */
.box { margin-inline-start: 1rem; }
In horizontal-tb ltr, inline-start resolves to left and block-start
to top. Switch to vertical-rl and the same logical properties remap to
physical edges automatically — so a single rule lays out correctly in any mode.
Tips and notes
- Prefer logical properties (
margin-inline,inset-block,border-inline-start) over physical ones for international layouts. text-orientationonly affects vertical writing modes; it is ignored inhorizontal-tb.vertical-rlis the traditional CJK default;vertical-lradvances columns left-to-right.- Combine
writing-mode: sideways-lrwith rotated table headers for compact, readable vertical labels.