1. 濾鏡
  2. hue-rotate

濾鏡

backdrop-filter: hue-rotate()

將背景色相旋轉濾鏡應用於元素的實用工具。

類別樣式
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>

使用自定義值

使用 backdrop-hue-rotate-[<value>] 語法 來設定背景色相旋轉基於完全自定義的值

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

對於 CSS 變數,您也可以使用 backdrop-hue-rotate-(<custom-property>) 語法

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

這只是 backdrop-hue-rotate-[var(<custom-property>)] 的簡寫,它會自動為您添加 var() 函數。

響應式設計

前綴一個 backdrop-filter: hue-rotate() 實用工具 帶有像 md: 這樣的斷點變體,僅在中等 螢幕尺寸及以上應用該實用工具

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

變體文檔中了解有關使用變體的更多信息。

Copyright © 2025 Tailwind Labs Inc.·商標政策