CSS block size 2026-11-05
CSS block size is a box's extent in the dimension perpendicular to text flow within a line. It corresponds to physical height in horizontal writing and physical width in vertical writing. The
block-size property expresses that dimension without fixing one physical axis in its name.[ref]CSS Writing Modes Level 4 by World Wide Web Consortium. §6.1, block dimension and block size; §6.4, mappings
[ref]CSS Logical Properties and Values Module Level 1 by World Wide Web Consortium. §4.1, block-size and inline-size
For an own example,
block-size: 80px; inline-size: 200px; describes a -by- CSS pixel rectangle in horizontal-tb and an -by- rectangle in vertical-lr, under simple definite-size assumptions. The latter has block progression toward the right, but the dimension's magnitude remains eighty pixels.Box edges matter. With
box-sizing: content-box; block-size: 20px;, ten-pixel padding and two-pixel borders on both block sides give an outer block extent ofpixels. That outer extent is physical height in a horizontal writing mode and physical width in a vertical one. CSS box-sizing and the applicable constraints determine how the declared value relates to the content and border boxes.The declaration
height: 50px; block-size: 80px; also changes meaning with writing mode. In horizontal writing, both address physical height, so the later block-size wins when their other cascade priorities are equal. In vertical writing, height constrains the inline dimension while block-size constrains physical width; both values can apply independently.[ref]CSS Logical Properties and Values Module Level 1 by World Wide Web Consortium. §4, logical/physical property pairing and cascade; §4.1, size mapping
CSS block flow direction identifies the direction in which blocks progress, whereas block size is a measurement along that axis. Moving from
vertical-rl to vertical-lr changes the progression direction without swapping block size back to physical height.An automatic block size can depend on content and layout, while min/max sizing properties can constrain the result. The useful interpretation is therefore an axis-relative size with the box-model and layout assumptions stated, not a universal promise that one declaration always fixes the painted rectangle exactly.
CSS inline size 2026-11-05
CSS inline size is a box's extent parallel to text flow within a line. It corresponds to physical width in a horizontal CSS writing mode and physical height in a vertical writing mode. The
inline-size property provides the corresponding flow-relative sizing control.[ref]CSS Writing Modes Level 4 by World Wide Web Consortium. §6.1, inline dimension and inline size; §6.4, mappings
[ref]CSS Logical Properties and Values Module Level 1 by World Wide Web Consortium. §4.1, block-size and inline-size properties
For an own definite-size example, let
inline-size: 180px; block-size: 60px; apply to a simple box with no padding, borders or competing constraints. Under horizontal-tb, the physical rectangle is by CSS pixels. Under vertical-rl, it is by . Inline size remains in both descriptions because the inline axis changes with the writing mode.CSS box-sizing determines which box dimension a declared size constrains. For example, with
box-sizing: border-box; inline-size: 80px;, ten-pixel padding and two-pixel borders on each inline side leavepixels of content extent along that axis, assuming no other sizing constraint intervenes. The outer inline extent is eighty, not fifty-six.Logical and physical properties can address the same underlying dimension. With equal cascade priorities in horizontal writing,
width: 100px; inline-size: 200px; supplies a later declaration for the same physical width, so the latter wins. In vertical writing, width and inline-size address different dimensions: physical width can be while physical height is .[ref]CSS Logical Properties and Values Module Level 1 by World Wide Web Consortium. §4, paired logical/physical properties and cascading; §4.1, size mapping
A direction reversal alone does not change which physical axis is inline. Changing CSS inline direction from left-to-right to right-to-left can exchange inline-start and inline-end without converting a horizontal inline size into height. Likewise, CSS block size measures the perpendicular axis.
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.