Browse documentation

Reference / Flexbox & grid

Flex basis

Set the starting size of a flex item along the main axis before the browser distributes free space.

Working example

A basis combines with grow and shrink. The final width can differ from the starting size when the row has extra space or runs short.

HTML
<div class="flex flex-wrap gap-3 border p-3">
  <strong class="basis-24">Colophon</strong>
  <p class="min-w-0 grow basis-32">Set in the studio and printed in small runs.</p>
</div>

Class reference

ClassCSS declarations
basis-0flex-basis: 0px;
basis-24flex-basis: 6rem;
basis-1/3flex-basis: 33.33333333333333%;
basis-1/2flex-basis: 50%;
basis-fullflex-basis: 100%;
basis-autoflex-basis: auto;
basis-[12ch]flex-basis: 12ch;
View full generated CSS
Compiled CSS
.basis-0 {
  flex-basis: 0px;
}
.basis-1\/2 {
  flex-basis: 50%;
}
.basis-1\/3 {
  flex-basis: 33.33333333333333%;
}
.basis-24 {
  flex-basis: 6rem;
}
.basis-\[12ch\] {
  flex-basis: 12ch;
}
.basis-auto {
  flex-basis: auto;
}
.basis-full {
  flex-basis: 100%;
}