flex

Class Description

flex

Sets the flex shorthand via --flex. E.g. 1 1 auto.

CSS Rules

.flex {
  flex: var(--flex);
}

Usage

The .flex class is flagged as a value-driven selector. The variable --flex is required.
<element class="flex" style="--flex: /* value */;" />

Responsive

Prefix .flex utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:flex" style="--md-flex: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="flex:hover" style="--flex-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="flex:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before flex::before" style="--flex-before: /* value */;" />

<element class="content-after flex::after" style="--flex-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="flex=value" />

<!-- Output -->
<element class="flex" style="--flex: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.flex Sets the flex shorthand via --flex. E.g. 1 1 auto.

flex-1

Sets flex: 1 1 0%. Item grows and shrinks equally.

CSS Rules

.flex-1 {
  flex: 1 1 0%;
}

Usage

<element class="flex-1" />

Responsive

Prefix .flex-1 utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:flex-1" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="flex-1:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="flex-1:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before flex-1::before" />

<element class="content-after flex-1::after" />
.flex-1 Sets flex: 1 1 0%. Item grows and shrinks equally.

flex-auto

Sets flex: 1 1 auto. Grows and shrinks based on content size.

CSS Rules

.flex-auto {
  flex: 1 1 auto;
}

Usage

<element class="flex-auto" />

Responsive

Prefix .flex-auto utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:flex-auto" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="flex-auto:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="flex-auto:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before flex-auto::before" />

<element class="content-after flex-auto::after" />
.flex-auto Sets flex: 1 1 auto. Grows and shrinks based on content size.

flex-initial

Sets flex to 0 1 auto, preventing the element from growing but allowing it to shrink.

CSS Rules

.flex-initial {
  flex: 0 1 auto;
}

Usage

<element class="flex-initial" />

Responsive

Prefix .flex-initial utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:flex-initial" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="flex-initial:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="flex-initial:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before flex-initial::before" />

<element class="content-after flex-initial::after" />
.flex-initial Sets flex to 0 1 auto, preventing the element from growing but allowing it to shrink.

flex-none

Sets flex: none. Item will not grow or shrink.

CSS Rules

.flex-none {
  flex: none;
}

Usage

<element class="flex-none" />

Responsive

Prefix .flex-none utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:flex-none" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="flex-none:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="flex-none:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before flex-none::before" />

<element class="content-after flex-none::after" />
.flex-none Sets flex: none. Item will not grow or shrink.