Effects

mask-type

Utilities for controlling how an SVG mask is interpreted.

ClassStyles
mask-type-alpha
mask-type: alpha;
mask-type-luminance
mask-type: luminance;

Examples

Basic example

Use the mask-type-alpha and mask-type-luminance utilities to control the type of an SVG mask:

mask-type-alpha

mask-type-luminance

<svg>  <mask id="blob1" class="mask-type-alpha fill-gray-700/70">    <path d="..."></path>  </mask>  <image href="/img/mountains.jpg" height="100%" width="100%" mask="url(#blob1)" /></svg><svg>  <mask id="blob2" class="mask-type-luminance fill-gray-700/70">    <path d="..."></path>  </mask>  <image href="/img/mountains.jpg" height="100%" width="100%" mask="url(#blob2)" /></svg>

When using mask-type-luminance the luminance value of the SVG mask determines visibility, so sticking with grayscale colors will produce the most predictable results. With mask-alpha, the opacity of the SVG mask determines the visibility of the masked element.

Responsive design

Prefix a mask-type utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<mask class="mask-type-alpha md:mask-type-luminance ...">  <!-- ... --></mask>

Learn more about using variants in the variants documentation.

Copyright © 2025 Tailwind Labs Inc.·Trademark Policy

Tailwind CSS 中文网(本网站)的目标是为中文开发者提供准确、及时的 Tailwind CSS 中文文档

Tailwind CSS 中文文档由本网站维护人员共同翻译,采用 MIT 开源协议发布

本网站与 tailwindcss.com 及 Tailwind Labs Inc. 并无从属关系

Tailwind 商标由 Tailwind Labs Inc. 所有

京ICP备15031610号-106