Open In App

Tailwind CSS Backdrop Brightness

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

The backdrop 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. Tailwind CSS newly added feature brightness in 2.1 version.

Backdrop Brightness Classes:

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

Syntax:

<element class="backdrop-filter 
                backdrop-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 ">
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1>
    <b>Tailwind CSS Backdrop Brightness Class</b>
    <div class=" mx-16 mt-18 h-36 relative">
        <div class="absolute w-full py-18">
            <img class="rounded-lg object-cover" 
                  src=
             alt="image">
        </div>
        <div class="relative h-32 flex overflow-x-auto space-x-4">
            <div class="flex-shrink-0 border-4 border-green-500 
                        backdrop-filter backdrop-brightness-75 w-1/3">
            </div>
            <div class="flex-shrink-0 border-4 border-green-500 
                        backdrop-filter backdrop-brightness-105 w-1/3">
            </div>
            <div class="flex-shrink-0 border-4 border-green-500 
                        backdrop-filter backdrop-brightness-150 w-1/3">
            </div>
        </div>
    </div>
</body>
  
</html>


Output:



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

Similar Reads