The inline-size property sets an element’s size along the inline axis. It is a logical alternative to width that adapts when writing direction or mode changes.
01
Logical Size
Inline axis.
02
auto
Default value.
03
Writing Mode
Adapts axis.
04
Percentages
Relative size.
05
fit-content
Content-based.
06
Responsive
Flexible layouts.
Fundamentals
Introduction
The inline-size property in CSS defines the horizontal or vertical size of an element, depending on the element’s writing mode. In horizontal writing modes, it sets the width. In vertical writing modes, it sets the height along the text flow direction.
This property is useful for responsive designs that must adapt to different writing modes, languages, and screen orientations without rewriting layout rules.
Definition and Usage
Apply inline-size to block containers, cards, columns, and any element where you would normally use width in a horizontal layout. Pair it with related logical properties such as block-size, margin-inline, and padding-inline for consistent logical layouts.
💡
Beginner Tip
In everyday horizontal English pages, inline-size: 200px behaves like width: 200px. The advantage appears when writing mode changes.
Foundation
📝 Syntax
The syntax for the inline-size property is similar to other sizing properties:
syntax.css
element{inline-size:value;}
Here, value can be a length, percentage, or keywords such as auto, max-content, min-content, and fit-content.
fit-content sizes the element to its content while respecting available space, useful for buttons, tags, and inline cards.
A11y
♿ Accessibility
Do not shrink text containers too narrowly — Small inline sizes can hurt readability.
Support zoom and reflow — Fixed inline sizes should not block text enlargement.
Writing mode changes affect layout — Test vertical layouts for logical reading order.
Keep touch targets wide enough — Buttons sized with fit-content still need adequate padding.
Maintain logical DOM order — Logical sizing does not replace semantic structure.
🧠 How inline-size Works
1
Writing mode defines the inline axis
Horizontal or vertical text flow determines whether inline-size maps to width or height.
Writing mode
2
You set an inline-size value
Choose auto, a length, percentage, or keyword like fit-content.
CSS rule
3
The browser resolves the dimension
The computed size is applied along the inline axis of the element’s containing block.
Layout
=
↔
Logical inline sizing
The element gets the correct dimension for its writing mode and layout context.
Compatibility
🖥 Browser Compatibility
The inline-size property is supported in modern browsers including Chrome 57+, Firefox 41+, Safari 12.1+, and Edge 79+.
✓ Baseline · Modern browsers
Logical sizing in today’s browsers
All major browsers support inline-size as part of the CSS Logical Properties module.
95%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
inline-size property95% supported
Bottom line: Safe to use in modern projects. For older browsers, width remains a reliable fallback.
Wrap Up
🎉 Conclusion
The inline-size property is a versatile tool for creating flexible, writing-mode-aware layouts. By understanding how it maps to the inline axis, you can build responsive designs that adapt to different languages and orientations.
For beginners, start with inline-size wherever you would use width in horizontal layouts, then explore vertical writing modes to see the logical advantage.
Use inline-size in multilingual or logical layouts
Pair with block-size for full logical sizing
Test with writing-mode: vertical-rl
Use fit-content for tags and compact UI chips
Provide width fallback only when needed for legacy support
❌ Don’t
Mix physical and logical sizing without a reason
Assume percentages work without a defined containing block
Force narrow inline sizes on long paragraphs
Forget padding and borders in total space calculations
Change writing mode without checking reading order
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about inline-size
Use these points when building logical layouts.
5
Core concepts
↔01
Inline Axis
Logical size.
Purpose
auto02
Default auto
Content-based.
Default
width03
Like width
Horizontal mode.
Syntax
vertical04
Writing mode
Rotates axis.
Pattern
fit05
Keywords
fit-content.
Values
❓ Frequently Asked Questions
inline-size sets the size of an element along the inline axis. In horizontal writing modes it acts like width; in vertical writing modes it acts like height.
The default is auto, which lets the browser calculate size from content and other layout properties.
width always controls horizontal size. inline-size follows the writing mode, so it adapts to horizontal or vertical text direction.
Use inline-size when building layouts that must support multiple writing modes or logical property patterns.
No. inline-size is not inherited, but percentage values are calculated relative to the containing block.