CSS block flow direction 2026-11-05
The CSS block flow direction is the direction in which block-level boxes and successive line boxes progress in the relevant flow. The
writing-mode property determines this direction: horizontal-tb progresses top to bottom, vertical-rl right to left, and vertical-lr left to right.[ref]For an own geometry example, take three ordinary in-flow block boxes with zero margins, borders and padding, each having inline size and block size CSS pixels. Assume no conflicting sizing constraints and a containing region sized to fit them. In
horizontal-tb, the parent is pixels wide and high. The boxes occupy successive vertical intervals , and .In
vertical-rl, those same CSS logical dimensions give a parent pixels wide and high. Measuring physical from the left edge, the first box occupies , the second and the third . Their source order is unchanged, but the block progression runs toward decreasing physical . These are stipulated box geometries, not font-dependent text measurements.[ref]CSS Writing Modes Level 4 by World Wide Web Consortium. §6.1, logical dimensions; §6.4, abstract-to-physical mappings
CSS inline direction concerns progression within a line and its base directionality. Setting
direction: rtl in an otherwise horizontal example does not make the block stack run upward: writing-mode still supplies its top-to-bottom block flow. Likewise, the rl in vertical-rl describes block progression rather than simply naming right-to-left text ordering.This distinction also affects CSS scroll origin, whose default anchor uses block-start and inline-start. In the horizontal example, block-start is top; in the vertical right-to-left block flow it is right. Rules expressed using logical starts and sizes can therefore follow the layout convention instead of hard-coding one physical edge.[ref]
CSS Writing Modes Level 4 by World Wide Web Consortium. §6.2, Flow-relative Directions; §6.4, mappings
CSS logical dimension 2026-11-05
A CSS logical dimension measures a box relative to text flow rather than a fixed physical axis. The inline dimension is parallel to the flow within a line; the block dimension is perpendicular to it. CSS inline size and CSS block size are measurements along those respective dimensions.[ref]
Let the inline size be and block size . In a horizontal writing mode, physical width and height areIn a vertical writing mode, their roles exchange:These equations describe the dimension mapping; the box's actual used sizes still follow the applicable sizing and layout rules.[ref]
CSS Writing Modes Level 4 by World Wide Web Consortium. §§6.1 and 6.4, dimension definitions and mappings; §7.2, dimensional mapping in layout
For a simple definite-size example, take inline size and block size CSS pixels, with no padding, borders or conflicting constraints. The physical box is by in
horizontal-tb, but by in vertical-rl or vertical-lr. The product is unchanged in this stipulated rectangle even though the physical width differs.A direction reversal is a different operation. Changing CSS inline direction can exchange inline-start and inline-end while leaving the dimension itself the same. Likewise,
vertical-rl and vertical-lr have the same inline/block axis mapping but different CSS block flow directions. An axis, its size and its directed start edge are related quantities with separate meanings.[ref]CSS Writing Modes Level 4 by World Wide Web Consortium. §6.2, Flow-relative Directions; §6.4, mappings
Logical dimensions help describe reusable layouts in terms such as the length available for a line and the extent available for successive lines or blocks. The specification's terms logical width and logical height refer to inline and block size respectively; they should not be read as promises about physical width and height in every mode.
This mapping also matters when a child uses a different writing mode from its containing context. Determine which box's CSS writing mode supplies each sizing reference before treating a number as a physical width. The dimension definitions provide the vocabulary, while the rules for the particular layout resolve its constraints.