Open In App
Related Articles

Tailwind CSS Contrast

Improve Article
Improve
Save Article
Save
Like Article
Like

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: 


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 23 Mar, 2022
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials