mask-size

Class Description

mask-size

Scales the mask layer that controls which parts of an element are visible.

CSS Rules

.mask-size {
  mask-size: var(--mask-size);
}

Usage

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

Responsive

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

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

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

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

CLS Alert

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

.mask-size Scales the mask layer that controls which parts of an element are visible.

mask-auto

Sets mask-size to auto, rendering the mask image at its natural size.

CSS Rules

.mask-auto {
  mask-size: auto;
}

Usage

<element class="mask-auto" />

Responsive

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

<element class="content-after mask-auto::after" />
.mask-auto Sets mask-size to auto, rendering the mask image at its natural size.

mask-cover

Sets mask-size to cover, scaling the mask image to fully cover the element.

CSS Rules

.mask-cover {
  mask-size: cover;
}

Usage

<element class="mask-cover" />

Responsive

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

<element class="md:mask-cover" />

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="mask-cover: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="mask-cover: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 mask-cover::before" />

<element class="content-after mask-cover::after" />
.mask-cover Sets mask-size to cover, scaling the mask image to fully cover the element.

mask-contain

Sets mask-size to contain, scaling the mask image to fit fully within the element.

CSS Rules

.mask-contain {
  mask-size: contain;
}

Usage

<element class="mask-contain" />

Responsive

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

<element class="md:mask-contain" />

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="mask-contain: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="mask-contain: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 mask-contain::before" />

<element class="content-after mask-contain::after" />
.mask-contain Sets mask-size to contain, scaling the mask image to fit fully within the element.