Filters
用於對元素套用背景色相旋轉濾鏡的通用類別。
| Class | Styles |
|---|---|
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-90 和 backdrop-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>] 語法,根據完全自訂的值來設定 backdrop hue rotation:
<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>在變體文件中了解更多關於使用變體的資訊。