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.
Chooses whether the block axis is vertical or horizontal
overflow
Recommended
Controls scroll or clip when content exceeds the cap
Try it
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
Code
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>
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.
How It Works
Set a ceiling.max-block-size: 120px stops growth on the block axis at 120 pixels.
Horizontal writing. With the default writing mode, the block axis is vertical, so this behaves like max-height: 120px.
Allow short content. If the text were only two lines, the box would stay shorter than 120px.
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>
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.
How It Works
Flip the axes.writing-mode: vertical-rl makes lines stack horizontally. The block axis is now left–right.
Keep the same property.max-block-size: 120px still caps the block axis. Here that means a maximum width of 120px.
Why not max-height?max-height would still limit physical height. Logical properties stay correct when writing mode changes.
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>
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.
How It Works
Give the parent a block size.block-size: 200px makes the containing block explicit on the block axis.
Use a percentage on the child.50% resolves to a 100px ceiling here.
Without a parent size. The percentage is treated as none, so the cap disappears.
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.
Compatibility
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 Chrome57+
Full support
Mozilla Firefox41+
Full support
Apple Safari12.1+
Full support
Microsoft Edge79+
Full support
Opera44+
Full support
Samsung Internet5+
Full support
Internet ExplorerNo support
None
max-block-sizeWidely 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.
Remember
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.