Open In App
Related Articles

Tailwind CSS Contrast

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

The Contrast class is used to apply to set the Contrast of the image. This class can increase or decrease Contrast. In CSS, we do that by using the CSS Contrast() Function. Tailwind CSS newly added feature brightness in 2.1 version.

Contrast:

  • Contrast-0: This class used to set the contrast equivalent to CSS contrast(0).
  • Contrast-50: This class used to set the contrast equivalent to CSS contrast(0.5).
  • Contrast-75: This class used to set the contrast equivalent to CSS contrast(0.75).
  • Contrast-100: This class used to set the contrast equivalent to CSS contrast(1.0).
  • Contrast-125: This class used to set the contrast equivalent to CSS contrast(1.25).
  • Contrast-150: This class used to set the contrast equivalent to CSS contrast(1.50).
  • Contrast-200: This class used to set the contrast equivalent to CSS contrast(2.0).

Syntax:

<element class="filter Contrast-{amount}">..</element>

Example:

HTML

<!DOCTYPE html>
<html>
<head>
    <link href=
"https://unpkg.com/tailwindcss@^2.1/dist/tailwind.min.css"
        rel="stylesheet">
</head>
  
<body class="text-center mx-4 space-y-2">
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1>
    <b>Tailwind CSS contrast Class</b>
    <div class="grid grid-flow-col text-center p-4">
        <img class="rounded-lg filter contrast-0" 
          src=
             alt="image">
        <img class="rounded-lg filter contrast-50" 
             src=
             alt="image">
        <img class="rounded-lg filter contrast-75" 
             src=
             alt="image">
        <img class="rounded-lg filter contrast-110" 
             src=
             alt="image">
        <img class="rounded-lg filter contrast-200" 
             src=
             alt="image">
          
    </div>
</body>
  
</html>

                    

Output: 



Last Updated : 23 Mar, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads