CSS max-block-size Property

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The max-block-size property sets the maximum size on the block axis. With the default writing-mode: horizontal-tb, that is the same job as max-height. In a vertical writing mode, it maps to max-width instead.

The box can stay smaller than the limit. It cannot grow past the ceiling on that axis. Cap the other axis with max-inline-size. Pair a tight cap with overflow when content may exceed it.

Standard-track.

Not deprecated. Length, percentage, and none are Baseline widely available. Intrinsic keywords such as fit-content and max-content are widely supported; stretch and some function forms are newer and limited.

Limited support stretch

The stretch keyword for max-block-size is not ready for everyday use. Prefer lengths, percentages, or none.

CSS Syntax

syntax.css
max-block-size: none | <length> | <percentage> | min-content | max-content | fit-content | initial | inherit;

Start with none, lengths, and percentages. Intrinsic keywords are optional extras.

Property Values

ValueDescriptionTry it
noneDefault. No maximum on the block axisTry it
<length>Fixed ceiling such as 120px, 12rem, or 50vhTry it
<percentage>Percent of the containing block’s block sizeTry it
writing-modeSame length, vertical text: the cap follows the block axisTry it
initialResets to noneTry it
inheritTakes the parent’s max-block-sizeTry it

How to Use max-block-size

Choose a ceiling on the block axis, then decide what happens when content is larger than that ceiling.

  1. Leave max-block-size: none when the box should grow freely on the block axis.
  2. Set a length or percentage to cap growth. In horizontal writing this feels like max-height.
  3. For percentages, give the containing block an explicit size on the block axis first.
  4. Add overflow: auto so extra content scrolls instead of spilling.
PieceRequired?Role
Block or replaced elementYesNon-replaced inlines ignore max-block-size
max-block-size valueYesnone, length, percentage, or keyword
Containing block sizeFor %Percentage resolves against the block-axis size of the containing block
writing-modeNoChooses whether the block axis is vertical or horizontal
overflowRecommendedControls scroll or clip when content exceeds the cap

Live Preview

Same long text, different max-block-size values in horizontal writing. Watch the box stop growing and scroll when capped.

Default writing mode is horizontal, so this acts like max-height. The outer frame is 200px tall so 50% can resolve.

Box
Line one of sample content.
Line two of sample content.
Line three of sample content.
Line four of sample content.
Line five of sample content.
Line six of sample content.

max-block-size: 80px

CSS Examples

Each snippet focuses on max-block-size. Use Try It Yourself for a live editor.

Example 1 — Fixed Length Cap

Stop the box at 120px on the block axis and scroll when content is taller.

CSS
<style>
  div {
    max-block-size: 120px;
    overflow: auto;
  }
</style>

<div>
  Line one.<br>
  Line two.<br>
  Line three.<br>
  Line four.<br>
  Line five.<br>
  Line six.
</div>
Try It Yourself

How It Works

  1. Set a ceiling. max-block-size: 120px stops growth on the block axis at 120 pixels.
  2. Horizontal writing. With the default writing mode, the block axis is vertical, so this behaves like max-height: 120px.
  3. Allow short content. If the text were only two lines, the box would stay shorter than 120px.
  4. Handle overflow. overflow: auto adds a scrollbar when the six lines need more than 120px.

Example 2 — Vertical Writing Mode

The same 120px cap follows the block axis when text runs vertically.

CSS
<style>
  div {
    writing-mode: vertical-rl;
    max-block-size: 120px;
    overflow: auto;
  }
</style>

<div>
  Line one.<br>
  Line two.<br>
  Line three.<br>
  Line four.<br>
  Line five.<br>
  Line six.
</div>
Try It Yourself

How It Works

  1. Flip the axes. writing-mode: vertical-rl makes lines stack horizontally. The block axis is now left–right.
  2. Keep the same property. max-block-size: 120px still caps the block axis. Here that means a maximum width of 120px.
  3. Why not max-height? max-height would still limit physical height. Logical properties stay correct when writing mode changes.
  4. Scroll the excess. overflow: auto keeps extra lines reachable inside the capped box.

Example 3 — Percentage of Parent

Cap a child at half of a parent that has an explicit block size.

CSS
<style>
  .parent {
    block-size: 200px;
  }

  .child {
    max-block-size: 50%;
    overflow: auto;
  }
</style>

<div class="parent">
  <div class="child">
    Line one.<br>
    Line two.<br>
    Line three.<br>
    Line four.<br>
    Line five.<br>
    Line six.
  </div>
</div>
Try It Yourself

How It Works

  1. Give the parent a block size. block-size: 200px makes the containing block explicit on the block axis.
  2. Use a percentage on the child. 50% resolves to a 100px ceiling here.
  3. Without a parent size. The percentage is treated as none, so the cap disappears.
  4. Scroll the excess. overflow: auto keeps the layout tidy when text is larger than the cap.

Edge Cases & Pitfalls

If the cap seems ignored, one of these is usually why.

axis

It is not always height

In vertical-rl or vertical-lr, max-block-size limits width. Use max-height only when you truly mean physical height.

percent

Percentage needs a parent block size

If the containing block’s block size depends on content (auto), a child max-block-size: 50% is treated as none.

overflow

Cap without overflow can clip

A max alone does not create a scrollbar. Set overflow so users can still reach hidden content.

override

max-block-size beats block-size

max-block-size overrides block-size when both apply. min-block-size overrides the max if the min is larger.

inline

Non-replaced inlines ignore it

A plain span does not take max-block-size. Use a block, flex item, or replaced element.

Browser Support

max-block-size is a browser layout property for logical sizing. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available since Jan 2020

max-block-size

Chrome 57+, Firefox 41+, Safari 12.1+, Edge 79+, Opera 44+, Samsung Internet 5+. Internet Explorer has no support. Intrinsic keywords are widely supported; stretch is newer and limited.

97% Modern browser support
Google Chrome 57+
Full support
Mozilla Firefox 41+
Full support
Apple Safari 12.1+
Full support
Microsoft Edge 79+
Full support
Opera 44+
Full support
Samsung Internet 5+
Full support
Internet Explorer No support
None
max-block-size Widely supported

Bottom line: Safe for lengths, percentages, and none in current browsers. Prefer physical max-height / max-width only when you must support Internet Explorer. Treat stretch as progressive enhancement.

Key Takeaways

  • Role: set a ceiling on the block axis, following writing-mode.
  • Common values: none, lengths, and percentages.
  • Initial value: none. Not inherited.
  • Mapping: horizontal writing → like max-height; vertical writing → like max-width.

One line: max-block-size is a writing-mode-aware ceiling on the block axis.

Frequently Asked Questions

It sets a maximum size on the block axis. In horizontal writing that usually caps height. In vertical writing it caps width instead. The box can stay smaller than the limit but cannot grow past it.
The initial value is none, which means there is no maximum on the block axis. The element can grow with its content.
max-height always limits physical height. max-block-size follows writing-mode: it acts like max-height in horizontal-tb and like max-width in vertical writing modes.
Yes. When the preferred block-size is larger than max-block-size, the max wins. min-block-size overrides max-block-size if the minimum is larger.
A percentage needs a containing block with an explicit size on the block axis. If that size depends on content, the percentage is treated as none.
It is Baseline and widely available since January 2020: Chrome 57+, Firefox 41+, Safari 12.1+, Edge 79+. Internet Explorer does not support it. It is a browser layout property, not a Node.js feature.

Next: max-height

Learn the physical vertical ceiling that always limits height.

max-height tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful