text-decoration-thickness

Class Description

decoration-thickness

Sets text-decoration-thickness via --decoration-thickness. E.g. 2px.

CSS Rules

.decoration-thickness {
  text-decoration-thickness: var(--decoration-thickness);
}

Usage

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

Responsive

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

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

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

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

CLS Alert

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

.decoration-thickness Sets text-decoration-thickness via --decoration-thickness. E.g. 2px.

decoration-from-font

Sets text-decoration-thickness to from-font, using the font's recommended thickness.

CSS Rules

.decoration-from-font {
  text-decoration-thickness: from-font;
}

Usage

<element class="decoration-from-font" />

Responsive

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

<element class="md:decoration-from-font" />

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="decoration-from-font: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="decoration-from-font: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 decoration-from-font::before" />

<element class="content-after decoration-from-font::after" />
.decoration-from-font Sets text-decoration-thickness to from-font, using the font's recommended thickness.

decoration-auto

Sets text-decoration-thickness to auto, using the browser's default thickness.

CSS Rules

.decoration-auto {
  text-decoration-thickness: auto;
}

Usage

<element class="decoration-auto" />

Responsive

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

<element class="content-after decoration-auto::after" />
.decoration-auto Sets text-decoration-thickness to auto, using the browser's default thickness.