Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Tailwind CSS Grayscale

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The Grayscale class is used to apply a filter to the image to set the grayscale of the image. In CSS, we do that by using the CSS grayscale() Function. Tailwind CSS newly added feature brightness in 2.1 version.

Grayscale:

  1. grayscale-0: This class is used to represents the original image.
  2. grayscale: This class is used to represents the linear multipliers on the effect.

Syntax:

<element class="filter grayscale | grayscale-0">..</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-20 space-y-2">
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1>
    <b>Tailwind CSS Grayscale Class</b>
    <div class="grid grid-flow-col text-center mx-44">
        <img class="rounded-lg filter grayscale" 
          src=
             alt="image">
        <img class="rounded-lg filter grayscale-0" 
             src=
             alt="image">
          
    </div>
</body>
  
</html>


Output:

My Personal Notes arrow_drop_up
Last Updated : 23 Mar, 2022
Like Article
Save Article
Similar Reads
Related Tutorials