滤镜
用于向元素应用对比度滤镜的实用工具。
| 类名 | 样式 |
|---|---|
contrast-<number> | filter: contrast(<number>%); |
contrast-(<custom-property>) | filter: contrast(var(<custom-property>)); |
contrast-[<value>] | filter: contrast(<value>); |
使用类似 contrast-50 和 contrast-100 这样的实用工具来控制元素的对比度
contrast-50
contrast-100
contrast-125
contrast-200
<img class="contrast-50 ..." src="/img/mountains.jpg" /><img class="contrast-100 ..." src="/img/mountains.jpg" /><img class="contrast-125 ..." src="/img/mountains.jpg" /><img class="contrast-200 ..." src="/img/mountains.jpg" />使用 contrast-[<value>] 语法 来设置contrast基于完全自定义的值
<img class="contrast-[.25] ..." src="/img/mountains.jpg" />对于 CSS 变量,你也可以使用 contrast-(<custom-property>) 语法
<img class="contrast-(--my-contrast) ..." src="/img/mountains.jpg" />这只是 contrast-[var(<custom-property>)] 的简写,它会自动为你添加 var() 函数。
前缀a filter: contrast() 实用工具 与断点变体(如 md:)一起使用,仅在中等 屏幕尺寸及以上时应用该实用工具
<img class="contrast-125 md:contrast-150 ..." src="/img/mountains.jpg" />在变体文档中了解更多关于使用变体的信息。