1. 滤镜
  2. 色相旋转

滤镜

backdrop-filter: hue-rotate()

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

样式
backdrop-hue-rotate-<数字>
backdrop-filter: hue-rotate(<数字>deg);
-backdrop-hue-rotate-<数字>
backdrop-filter: hue-rotate(calc(<数字>deg * -1));
backdrop-hue-rotate-(<自定义属性>)
backdrop-filter: hue-rotate(var(<自定义属性>));
backdrop-hue-rotate-[<值>]
backdrop-filter: hue-rotate(<值>);

示例

基本示例

使用 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>

使用自定义值

使用 backdrop-hue-rotate-[<值>] 语法 来设置背景色相旋转基于完全自定义的值

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

对于 CSS 变量,您也可以使用 backdrop-hue-rotate-(<自定义属性>) 语法

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

这只是 backdrop-hue-rotate-[var(<自定义属性>)] 的简写,它会自动为您添加 var() 函数。

响应式设计

前缀 backdrop-filter: hue-rotate() 实用工具 与断点变体(如 md:)一起使用,以便仅在中等 屏幕尺寸及以上应用实用工具

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

变体文档中了解有关使用变体的更多信息。

版权所有 © 2025 Tailwind Labs Inc.·商标政策