Flexbox & GridFlex

Flex

Controls how flex elements grow and shrink.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari
ClassStyle
f-1flex: 1 1 0%;
f-2flex: 2 2 0%;
f-3flex: 3 3 0%;
f-4flex: 4 4 0%;
f-5flex: 5 5 0%;
f-6flex: 6 6 0%;
f-autoflex: 1 1 auto;
f-noneflex: none;

This example showcases various flex utilities:

  • The f-none flex utility sets the flex property to none, preventing the item from growing or shrinking.
  • The f-1 flex utility sets the flex property to 1 1 0%, allowing the item to grow and shrink equally with a base size of 0.
  • Finally, f-auto flex utility sets the flex property to 1 1 auto, allowing the item to grow and shrink with a base size determined by its content.
A
B
C
<div class="tc-white">
<div class="d-f g-4 h-24 w-full">
<div class="ai-c bg-indigo d-f f-none jc-c p-4">A</div>
<div class="ai-c bg-indigo d-f f-1 jc-c p-4">B</div>
<div class="ai-c bg-indigo d-f f-auto jc-c p-4">C</div>
</div>
</div>

Using utility variants

Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.

Targeting different viewports

You can combine responsive breakpoints like sm:f-*, md:f-*, lg:f-*, and xxl:f-* to allow targeting specific utilities in different viewports.

Targeting hover states

Alternatively, you can apply :hover by using h:f-* utility to override elements and change their values when hovering over them.