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
Production schedule
ReadyFlex-1 starts from a zero basis. Flex-auto takes the item’s initial size into account when distributing space.
<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
| Class | CSS declarations |
|---|---|
flex-1 | flex: 1 1 0%; |
flex-auto | flex: 1 1 auto; |
flex-initial | flex: 0 1 auto; |
flex-none | flex: none; |
flex-[2_1_0%] | flex: 2 1 0%; |
View full generated 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;
}