The Tailwind CSS saturate class is an inbuilt function that is used to super-saturate or desaturate the input image. In CSS, we do that by using the CSS saturate() Function. Tailwind CSS newly added feature brightness in 2.1 version.
Saturate Classes:
- saturate-0: This class used to set the saturate value, equivalent to CSS saturate(0).
- saturate-50: This class used to set the saturate value, equivalent to CSS saturate(50).
- saturate-100: This class used to set the saturate value, equivalent to CSS saturate(100).
- saturate-150: This class used to set the saturate value, equivalent to CSS saturate(150).
- saturate-200: This class used to set the saturate value, equivalent to CSS saturate(200).
Syntax:
<element class="filter saturate-{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 Saturate Class</ b >
< div class = "grid grid-flow-col text-center p-4" >
< img class = "rounded-lg filter saturate-0" src =
alt = "image" >
< img class = "rounded-lg filter saturate-50" src =
alt = "image" >
< img class = "rounded-lg filter saturate-75" src =
alt = "image" >
< img class = "rounded-lg filter saturate-110" src =
alt = "image" >
< img class = "rounded-lg filter saturate-200" src =
alt = "image" >
</ div >
</ body >
</ html >
|
Output: