1. 滤镜
  2. 饱和

滤镜

backdrop-filter: saturate()

应用背景饱和度滤镜到元素的工具类。

ClassStyles
backdrop-saturate-<number>
backdrop-filter: saturate(<number>%);
backdrop-saturate-(<custom-property>)
backdrop-filter: saturate(var(<custom-property>));
backdrop-saturate-[<value>]
backdrop-filter: saturate(<value>);

示例

基本示例

使用诸如 backdrop-saturate-50backdrop-saturate-100 的工具类来控制元素背后的饱和度:

backdrop-saturate-50

backdrop-saturate-125

backdrop-saturate-200

<div class="bg-[url(/img/mountains.jpg)]">
<div class="bg-white/30 backdrop-saturate-50 ..."></div>
</div>
<div class="bg-[url(/img/mountains.jpg)]">
<div class="bg-white/30 backdrop-saturate-125 ..."></div>
</div>
<div class="bg-[url(/img/mountains.jpg)]">
<div class="bg-white/30 backdrop-saturate-200 ..."></div>
</div>

使用自定义值

Use the backdrop-saturate-[<value>] syntax to set the 背景饱和度 based on a completely custom value:

<div class="backdrop-saturate-[.25] ...">
<!-- ... -->
</div>

For CSS variables, you can also use the backdrop-saturate-(<custom-property>) syntax:

<div class="backdrop-saturate-(--my-backdrop-saturation) ...">
<!-- ... -->
</div>

This is just a shorthand for backdrop-saturate-[var(<custom-property>)] that adds the var() function for you automatically.

响应式设计

Prefix a backdrop-filter: saturate() utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<div class="backdrop-saturate-50 md:backdrop-saturate-150 ...">
<!-- ... -->
</div>

Learn more about using variants in the variants documentation.