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>);

示例(Examples)

¥Examples

基本示例(Basic example)

¥Basic example

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

¥Use utilities like backdrop-hue-rotate-90 and backdrop-hue-rotate-180 to rotate the hue of an element's backdrop:

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>

使用负值(Using negative values)

¥Using negative values

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

¥Use utilities like -backdrop-hue-rotate-90 and -backdrop-hue-rotate-180 to set a negative backdrop hue rotation value:

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

使用自定义值(Using a custom value)

¥Using a custom value

使用 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() 函数。

响应式设计(Responsive design)

¥Responsive design

backdrop-filter: hue-rotate() 工具前面使用断点变体如 md: 仅在 medium 屏幕尺寸及以上时应用工具:

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

请参阅 变体文档 详细了解如何使用变体。

TailwindCSS v4.0 中文网 - 粤ICP备13048890号