1. 滤镜
  2. hue-rotate

滤镜

backdrop-filter: hue-rotate()

用于对元素应用背景色相旋转滤镜的工具类。

ClassStyles
backdrop-hue-rotate-<number>
backdrop-filter: hue-rotate(<number>deg);
-backdrop-hue-rotate-<number>
backdrop-filter: hue-rotate(calc(<number>deg * -1));
backdrop-hue-rotate-(<custom-property>)
backdrop-filter: hue-rotate(var(<custom-property>));
backdrop-hue-rotate-[<value>]
backdrop-filter: hue-rotate(<value>);

示例

基础示例

使用 backdrop-hue-rotate-90backdrop-hue-rotate-180 等工具类来旋转元素背景的色相:

backdrop-hue-rotate-90

backdrop-hue-rotate-180

backdrop-hue-rotate-270

<div class="bg-[url(/img/mountains.jpg)]">  <div class="bg-white/30 backdrop-hue-rotate-90 ..."></div></div><div class="bg-[url(/img/mountains.jpg)]">  <div class="bg-white/30 backdrop-hue-rotate-180 ..."></div></div><div class="bg-[url(/img/mountains.jpg)]">  <div class="bg-white/30 backdrop-hue-rotate-270 ..."></div></div>

使用负值

使用 -backdrop-hue-rotate-90-backdrop-hue-rotate-180 等工具类来设置负的背景色相旋转值:

-backdrop-hue-rotate-15

-backdrop-hue-rotate-45

-backdrop-hue-rotate-90

<div class="bg-[url(/img/mountains.jpg)]">  <div class="bg-white/30 -backdrop-hue-rotate-15 ..."></div></div><div class="bg-[url(/img/mountains.jpg)]">  <div class="bg-white/30 -backdrop-hue-rotate-45 ..."></div></div><div class="bg-[url(/img/mountains.jpg)]">  <div class="bg-white/30 -backdrop-hue-rotate-90 ..."></div></div>

使用自定义值

Use the backdrop-hue-rotate-[<value>] syntax to set the 背景色相旋转 based on a completely custom value:

<div class="backdrop-hue-rotate-[3.142rad] ...">  <!-- ... --></div>

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

<div class="backdrop-hue-rotate-(--my-backdrop-hue-rotation) ...">  <!-- ... --></div>

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

响应式设计

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

<div class="backdrop-hue-rotate-15 md:backdrop-hue-rotate-0 ...">  <!-- ... --></div>

Learn more about using variants in the variants documentation.

Copyright © 2025 Tailwind Labs Inc.·Trademark Policy