grid-auto-columns

Class Description

auto-cols

Sets implicit grid column sizing with an arbitrary grid-auto-columns value.

CSS Rules

.auto-cols {
  grid-auto-columns: var(--auto-cols);
}

Usage

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

Responsive

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

<element class="md:auto-cols" style="--md-auto-cols: /* 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="auto-cols:hover" style="--auto-cols-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="auto-cols: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 auto-cols::before" style="--auto-cols-before: /* value */;" />

<element class="content-after auto-cols::after" style="--auto-cols-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="auto-cols=value" />

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

CLS Alert

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

.auto-cols Sets implicit grid column sizing with an arbitrary grid-auto-columns value.

auto-cols-auto

Sizes implicit grid columns by their natural content size.

CSS Rules

.auto-cols-auto {
  grid-auto-columns: auto;
}

Usage

<element class="auto-cols-auto" />

Responsive

Prefix .auto-cols-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:auto-cols-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="auto-cols-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="auto-cols-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 auto-cols-auto::before" />

<element class="content-after auto-cols-auto::after" />
.auto-cols-auto Sizes implicit grid columns by their natural content size.

auto-cols-fr

Distributes implicit grid columns evenly using fractional 1fr tracks.

CSS Rules

.auto-cols-fr {
  grid-auto-columns: minmax(0, 1fr);
}

Usage

<element class="auto-cols-fr" />

Responsive

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

<element class="md:auto-cols-fr" />

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="auto-cols-fr: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="auto-cols-fr: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 auto-cols-fr::before" />

<element class="content-after auto-cols-fr::after" />
.auto-cols-fr Distributes implicit grid columns evenly using fractional 1fr tracks.

auto-cols-max

Sizes implicit grid columns to their maximum content size.

CSS Rules

.auto-cols-max {
  grid-auto-columns: max-content;
}

Usage

<element class="auto-cols-max" />

Responsive

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

<element class="md:auto-cols-max" />

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="auto-cols-max: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="auto-cols-max: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 auto-cols-max::before" />

<element class="content-after auto-cols-max::after" />
.auto-cols-max Sizes implicit grid columns to their maximum content size.

auto-cols-min

Sizes implicit grid columns to their minimum content size.

CSS Rules

.auto-cols-min {
  grid-auto-columns: min-content;
}

Usage

<element class="auto-cols-min" />

Responsive

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

<element class="md:auto-cols-min" />

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="auto-cols-min: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="auto-cols-min: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 auto-cols-min::before" />

<element class="content-after auto-cols-min::after" />
.auto-cols-min Sizes implicit grid columns to their minimum content size.