Tailwind CSS - Backdrop Contrast
Tailwind CSS backdrop-contrast 是一个实用类,用于将背景对比度滤镜应用于元素。
Tailwind CSS backdrop-contrast 类
以下是用于有效应用背景对比度滤镜的 Tailwind CSS 背景对比度 类列表。
| 类 | CSS 属性 |
|---|---|
| backdrop-contrast-0 | backdrop-filter: contrast(0); |
| backdrop-contrast-50 | backdrop-filter: contrast(.5); |
| backdrop-contrast-75 | backdrop-filter: contrast(.75); |
| backdrop-contrast-100 | backdrop-filter: contrast(1); |
| backdrop-contrast-125 | backdrop-filter: contrast(1.25); |
| backdrop-contrast-150 | backdrop-filter: contrast(1.5); |
| backdrop-contrast-200 | backdrop-filter: contrast(2); |
Tailwind CSS 背景对比度类的功能
- backdrop-contrast-* 类用于有效调整元素的背景对比度。{* 指定了可根据需要设置的不同对比度值。
Tailwind CSS 背景对比度类示例
以下示例说明了 Tailwind CSS 背景对比度类的不同可见性和实用性。
示例
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="p-8">
<h2 class="text-2xl font-bold mb-3">
Tailwind CSS Backdrop Contrast Classes
</h2>
<div class="flex gap-3 flex-wrap ">
<div class="relative w-44 h-44">
<img class="object-cover w-full h-full"
src=
"/javascript/images/javascript.jpg"
alt="Image">
<div class="backdrop-contrast-50 absolute w-36 h-36
border-2 border-green-500 top-4 left-4
text-red-600 font-bold py-12 text-center">
Backdrop-contrast-50
</div>
</div>
<div class="relative w-44 h-44 ">
<img class="object-cover w-full h-full"
src=
"/javascript/images/javascript.jpg"
alt="Image">
<div class="backdrop-contrast-75 absolute w-36 h-36
border-2 border-green-500 top-4 left-4
text-red-600 font-bold py-12 text-center">
Backdrop-contrast-75
</div>
</div>
<div class="relative w-44 h-44 ">
<img class="object-cover w-full h-full"
src=
"/javascript/images/javascript.jpg"
alt="Image">
<div class="backdrop-contrast-100 absolute w-36 h-36
border-2 border-green-500 top-4 left-4
text-red-600 font-bold py-12 text-center">
Backdrop-contrast-100
</div>
</div>
<div class="relative w-44 h-44 ">
<img class="object-cover w-full h-full"
src=
"/javascript/images/javascript.jpg"
alt="Image">
<div class="backdrop-contrast-200 absolute w-36 h-36
border-2 border-green-500 top-4 left-4
text-red-600 font-bold py-12 text-center">
Backdrop-contrast-200
</div>
</div>
</div>
</body>
</html>

