Tailwind CSS - 背景對比



Tailwind CSS 背景對比 是一個實用程式類,用於將背景對比濾鏡應用於元素。

Tailwind CSS 背景對比類

以下是用於有效應用背景對比濾鏡的 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>
廣告

© . All rights reserved.