1. 滤镜
  2. 复古

滤镜

backdrop-filter: sepia()

用于将背景 sepia 滤镜应用于元素的工具类。

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

示例

基本示例

使用工具类如 backdrop-sepiabackdrop-sepia-50 来控制应用于元素背景的 sepia 效果:

backdrop-sepia-0

backdrop-sepia-50

backdrop-sepia

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

使用自定义值

Use the backdrop-sepia-[<value>] syntax to set the backdrop sepia based on a completely custom value:

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

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

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

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

响应式设计

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

<div class="backdrop-sepia md:backdrop-sepia-0 ...">
<!-- ... -->
</div>

Learn more about using variants in the variants documentation.