Browse documentation

Reference / Flexbox & grid

Flex

Set how a flex item takes up free space and gives it back. Share the row between flexible text and a fixed-size label.

Working example

Flex-1 starts from a zero basis. Flex-auto takes the item’s initial size into account when distributing space.

HTML
<div class="flex items-center gap-3 border p-3">
  <p class="min-w-0 flex-1">Production schedule</p>
  <span class="flex-none bg-black px-2 text-white">Ready</span>
</div>

Class reference

ClassCSS declarations
flex-1flex: 1 1 0%;
flex-autoflex: 1 1 auto;
flex-initialflex: 0 1 auto;
flex-noneflex: none;
flex-[2_1_0%]flex: 2 1 0%;
View full generated CSS
Compiled CSS
.flex-1 {
  flex: 1 1 0%;
}
.flex-\[2_1_0\%\] {
  flex: 2 1 0%;
}
.flex-auto {
  flex: 1 1 auto;
}
.flex-initial {
  flex: 0 1 auto;
}
.flex-none {
  flex: none;
}