CSS Reference ยท Container Queries and Logical Properties
The min-inline-size property
Reference for the CSS min-inline-size property: the logical minimum width that follows the writing mode, with examples, flex item notes and related properties.
The min-inline-size property sets the smallest size an element may have along the inline axis. In horizontal writing modes it works like min-width; in vertical writing modes it works like min-height.
If other rules (a percentage, a flex item shrinking, a grid track) would make the element smaller than this value, the element stops at min-inline-size.
.button { min-inline-size: 8rem; }
Try it
Twenty percent of the track would be about 60 pixels; the minimum keeps the second bar at 140.
Syntax
min-inline-size: auto | <length> | <percentage> | min-content | max-content | fit-content | fit-content(<length-percentage>) | stretch
- Initial value:
auto - Applies to: same as
widthandheight - Inherited: no
- Animatable: yes, as a length or percentage
- Computed value: as for
min-width - Percentages: relative to the inline size of the containing block
Values
| Value | Description |
|---|---|
auto |
For most boxes, behaves as 0. For flex and grid items it is the automatic minimum size, based on the item's content. |
<length> |
A fixed minimum such as 10rem. |
<percentage> |
A share of the containing block's inline size. |
min-content, max-content, fit-content |
Intrinsic sizing keywords based on the element's content. |
stretch |
The minimum is the full available space. Newer; check a compatibility table. |
Usage notes
- Wins over
inline-size. Ifmin-inline-sizeis larger thaninline-size, the minimum is used. The same holds whenmax-inline-sizeis smaller than the minimum: the minimum still wins. - Flex items and
0. A flex or grid item withautohas an automatic minimum size, so a long word or wide image can keep it from shrinking. Settingmin-inline-size: 0lets the item shrink below its content and enables clipping, ellipsis or scrolling. It is the fix for many "my flex item overflows" bugs. - Mind
box-sizing. Withcontent-box, the minimum applies to the content area and padding and border are extra. Withborder-boxit includes them. Seebox-sizing. - Do not use it to hide overflow. A minimum that is bigger than the space available causes horizontal scrolling, especially on small screens. Prefer relative values like
min(100%, 20rem)when the layout must fit. - Writing modes. The physical side changes with the element's
writing-mode. If your layout never rotates,min-widthis just as good. - Pair with a maximum.
max-inline-sizeandmin-inline-sizetogether create a range for the size, much likeclamp().
Browser support
Supported in all current major browsers and part of Baseline; the stretch keyword is newer, so check a compatibility table.
Related
max-inline-sizeโ the logical maximum widthinline-sizeโ the logical widthmin-block-sizeโ the logical minimum heightmin-widthโ the physical property- Lessons: Width and Height, Writing Modes