The block-size property sets an element’s size along the block axis — the direction text flows in blocks. In everyday horizontal layouts, that usually means height. It is part of CSS logical sizing, which adapts better to different writing modes.
01
Block Axis
Size in the flow direction.
02
Syntax
Length, %, and keywords.
03
auto Default
Content-based sizing.
04
Writing Modes
Works beyond height.
05
Logical Pairs
Use with inline-size.
06
Responsive
Percentages and fit-content.
Fundamentals
Definition and Usage
The block-size CSS property controls the size of an element in the block dimension. In horizontal writing modes such as English, the block axis runs top to bottom, so block-size behaves like height.
In vertical writing modes, the block axis runs sideways, so the same property controls width instead. That makes block-size useful for international layouts and components that must work in more than one writing direction.
💡
Beginner Tip
If you are building a simple left-to-right page, think of block-size: 200px; as “make this box 200px tall.” Pair it with inline-size when you want logical width and height together.
Foundation
📝 Syntax
Write block-size with a length, percentage, or sizing keyword:
The default value of block-size is auto. That means the browser calculates the block dimension from the element’s content, padding, borders, margins, and related sizing properties such as min-block-size and max-block-size.
Reference
💎 Property Values
These are the most common values you will use with block-size.
Value
Example
Meaning
Length
block-size: 200px;
Sets a fixed block size using units like px, em, or rem
Percentage
block-size: 50%;
Sizes relative to the containing block’s block dimension
auto
block-size: auto;
Lets the browser calculate size from content and layout rules
max-content
block-size: max-content;
Uses the content’s intrinsic maximum block size
min-content
block-size: min-content;
Uses the content’s intrinsic minimum block size
fit-content
block-size: fit-content;
Fits the content without exceeding available space
A fixed block size in pixels or other length units.
Fixed length
Most common for cards and panels.
50%
Half of the parent container’s block size.
50% of parent
Useful in responsive layouts.
auto
Size grows or shrinks with content naturally.
Content height
Default browser behavior.
fit-content
Fits content while respecting available space.
Fit content
Good for flexible components.
Scope
Block Size and Writing Modes
block-size follows the writing mode instead of always mapping to vertical height. That is the main reason to choose it over physical properties like height and width.
Horizontal writing (writing-mode: horizontal-tb)
block-size controls height
Vertical writing (writing-mode: vertical-rl)
block-size controls width
inline-size is the logical counterpart for the inline axis (usually width in English).
min-block-size and max-block-size set lower and upper limits on the block axis.
Logical properties help components stay correct when text direction or writing mode changes.
Compare
block-size vs height
Property
Axis
Best for
block-size
Block axis (depends on writing mode)
International layouts, reusable components, logical sizing systems
height
Always vertical
Simple pages with fixed vertical sizing in horizontal writing
inline-size
Inline axis (depends on writing mode)
Logical width paired with block-size
width
Always horizontal
Simple fixed-width boxes in horizontal writing
Preview
👀 Live Preview
Three boxes with different fixed block-size values in a normal horizontal layout:
block-size: 3rem
block-size: 5rem
block-size: 7rem
In horizontal writing, these values control height.
Hands-On
Examples Gallery
Try block-size with fixed lengths, percentages, content keywords, and vertical writing mode.
📚 Fixed Block Sizing
Set an exact block dimension when you need predictable panel or card heights.
Example 1 — Fixed Block Size with Pixels
Set a box to 200px along the block axis. In horizontal writing, that means 200px tall.
block-size-fixed.html
<style>.box{block-size:200px;background-color:lightblue;}</style><divclass="box">
This box has a block size of 200px.
</div>
With writing-mode: vertical-rl, the block axis runs horizontally, so block-size: 180px; sets the panel width rather than its height.
🧠 How block-size Works
1
The browser finds the block axis
Writing mode decides which direction is block. In normal English pages, that is top to bottom.
Writing mode
2
You set a block-size value
Choose a length, percentage, or keyword such as 200px, 50%, or fit-content.
CSS rule
3
Limits and content are applied
min-block-size, max-block-size, padding, and content all influence the final size.
Box model
=
📏
Logical block dimension
The element gets a predictable size along the block axis, even when writing mode changes.
Compatibility
Universal Browser Support
block-size is supported in all modern browsers. Internet Explorer does not support logical sizing properties.
✓ Baseline · Modern browsers
Logical sizing in today’s browsers
Chrome, Firefox, Safari, Edge, and Opera all support block-size and related logical properties in current versions.
96%Modern browser support
Google Chrome57+ · Desktop & Mobile
Full support
Mozilla Firefox41+ · Desktop & Mobile
Full support
Apple Safari12.1+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera44+ · Modern versions
Full support
Fallback behavior
For older browsers, you can pair logical properties with physical ones such as height as a fallback.
💻
Internet ExplorerNo support · Use height or width instead
None
block-size property96% supported
Bottom line: Use block-size confidently in modern projects, especially when writing mode matters.
Wrap Up
Conclusion
The block-size property is a logical way to control an element’s size along the block axis. In everyday horizontal layouts it often behaves like height, but it stays correct when writing mode or text direction changes.
By using block-size with values like pixels, percentages, and content keywords, you can build layouts that are more flexible and easier to adapt across languages and screen sizes.
Use block-size with inline-size for logical layout systems
Set a parent block size when using percentage values on children
Combine with min-block-size and max-block-size for flexible limits
Prefer logical properties in components that may change writing mode
Test layouts in both horizontal and vertical writing when possible
❌ Don’t
Mix confusing physical and logical sizing without a reason
Expect percentages to work when the parent block size is undefined
Forget overflow behavior when content exceeds a fixed block size
Assume block-size always equals height in every layout
Skip fallbacks if you must support very old browsers
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about block-size
Use these points when sizing elements logically.
5
Core concepts
📏01
Block Axis
Logical flow direction.
Purpose
📝02
auto Default
Content-based size.
Default
🔄03
Writing Mode
Changes which side grows.
Context
📈04
Percentages
Relative to parent.
Responsive
🛠05
Logical Pair
Use with inline-size.
System
❓ Frequently Asked Questions
The block-size property sets an element's size along the block axis. In normal horizontal writing, that is the height. In vertical writing modes, it becomes the width.
The initial value is auto, which lets the browser calculate the block dimension from content, padding, borders, and other sizing rules.
height always controls vertical size. block-size follows the writing mode, so it stays correct when text flows vertically or when you support multiple languages and layouts.
Common values include length units like px and rem, percentages, auto, max-content, min-content, and fit-content().
For simple English pages, height is still common. Use block-size when you want logical sizing that adapts to writing mode, especially in international or vertical layouts.