Open In App

Tailwind CSS Brightness

Last Updated : 23 Mar, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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

Brightness:

  • brightness-0: This class used to set the brightness equivalent to CSS brightness(0).
  • brightness-50: This class used to set the brightness equivalent to CSS brightness(0.5).
  • brightness-75: This class used to set the brightness equivalent to CSS brightness(0.75).
  • brightness-90: This class used to set the brightness equivalent to CSS brightness(0.9).
  • brightness-95: This class used to set the brightness equivalent to CSS brightness(0.95).
  • brightness-100: This class used to set the brightness equivalent to CSS brightness(1.0).
  • brightness-105: This class used to set the brightness equivalent to CSS brightness(1.05).
  • brightness-110: This class used to set the brightness equivalent to CSS brightness1.10).
  • brightness-125: This class used to set the brightness equivalent to CSS brightness(1.25).
  • brightness-150: This class used to set the brightness equivalent to CSS brightness(1.50).
  • brightness-200: This class used to set the brightness equivalent to CSS brightness(2.0).

Syntax:

<element class="filter brightness-{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 brightness Class</b>
    <div class="grid grid-flow-col text-center p-4">
        <img class="rounded-lg filter brightness-0" 
          src=
             alt="image">
        <img class="rounded-lg filter brightness-50" 
             src=
             alt="image">
        <img class="rounded-lg filter brightness-75" 
             src=
             alt="image">
        <img class="rounded-lg filter brightness-110" 
             src=
             alt="image">
        <img class="rounded-lg filter brightness-200" 
             src=
             alt="image">
          
    </div>
</body>
  
</html>


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads