Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

max-block-size — maximum size on the block axis

max-block-size limits an element’s size on the block axis. Depending on writing-mode, it corresponds to max-height or max-width instead of always constraining the same physical dimension.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

max-block-size: <'max-width'>;
/* Examples */
max-block-size: none;
max-block-size: 120px;
max-block-size: 50%;
max-block-size: min-content;
max-block-size: max-content;
max-block-size: fit-content(200px);

max-block-size sets an upper constraint on the block-axis size, not a target size. With writing-mode: horizontal-tb, it corresponds to max-height; with vertical-rl and vertical-lr, it corresponds to max-width. Its initial value is none, and it is not inherited.

It accepts the syntax of max-width, including nonnegative lengths and percentages, none, min-content, max-content, and fit-content(...). Percentages refer to the corresponding dimension of the containing block; do not assume a straightforward percentage cap when that dimension depends on content.

A larger min-block-size takes precedence over the maximum constraint. box-sizing determines which box area the limit constrains. The limit alone does not enable scrolling or clip content.

In the example, block-size: 120px is capped at 60px. Changing writing-mode moves the constraint from height to width, while inline-size remains 160px.

Examples

<!doctype html>
<meta charset="utf-8">
<title>max-block-size</title>
<style>
  .box {
    box-sizing: border-box;
    writing-mode: horizontal-tb;
    block-size: 120px;
    max-block-size: 60px;
    inline-size: 160px;
    padding: 0;
    border: 0;
    background: lightblue;
  }
  .vertical { writing-mode: vertical-rl; }
</style>
<div class="box" id="horizontal"></div>
<div class="box vertical" id="vertical"></div>

Result

horizontal: width = 160px, height = 60px
vertical: width = 60px, height = 160px

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources