Skip to content
Tutorials Center
My learning

Topics

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.

CSS
.button {
  min-inline-size: 8rem;
}

Try it

A floor under a percentage size

Twenty percent of the track would be about 60 pixels; the minimum keeps the second bar at 140.

Syntax

CSS
min-inline-size: auto | <length> | <percentage> | min-content | max-content
               | fit-content | fit-content(<length-percentage>) | stretch
  • Initial value: auto
  • Applies to: same as width and height
  • 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. If min-inline-size is larger than inline-size, the minimum is used. The same holds when max-inline-size is smaller than the minimum: the minimum still wins.
  • Flex items and 0. A flex or grid item with auto has an automatic minimum size, so a long word or wide image can keep it from shrinking. Setting min-inline-size: 0 lets 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. With content-box, the minimum applies to the content area and padding and border are extra. With border-box it includes them. See box-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-width is just as good.
  • Pair with a maximum. max-inline-size and min-inline-size together create a range for the size, much like clamp().

Browser support

Supported in all current major browsers and part of Baseline; the stretch keyword is newer, so check a compatibility table.