Open In App

Tailwind CSS Brightness

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:



Syntax:

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

Example:






<!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:


Article Tags :