Backdrop Brightness In Tailwind CSS
In this article, we will discuss and demonstrate the use cases of the Tailwind Backdrop Brightness class.
Tailwind CSS enables developers to use the Backdrop Brightness class in all web browsers. The brightness feature was introduced in Tailwind CSS version 2.1.
In normal CSS, the Backdrop Brightness class is part of the Backdrop Filter module, which is a new module that is not yet supported by all browsers.
Tailwind Backdrop Brightness
One of the many useful utility classes available in Tailwind is the Backdrop Brightness class.
Using the backdrop brightness class, the brightness of an image can be adjusted.
It increases or decreases brightness using a linear multiplier.
Tailwind Backdrop Brightness Classes
- backdrop-brightness-0 – The brightness of an element is set to 0% of default brightness using this class. Equivalent to CSS brightness(0).
- backdrop-brightness-50 – The brightness of an element is set to 50% of default brightness using this class. Equivalent to CSS brightness(0.5).
- backdrop-brightness-75 – The brightness of an element is set to 75% of default brightness using this class. Equivalent to CSS brightness(0.75).
- backdrop-brightness-90 – The brightness of an element is set to 90% of default brightness using this class. Equivalent to CSS brightness(0.9).
- backdrop-brightness-95 – The brightness of an element is set to 95% of default brightness using this class. Equivalent to CSS brightness(0.95).
- backdrop-brightness-100 – The brightness of an element is set to default using this class. Equivalent to CSS brightness(1.0).
- backdrop-brightness-105 – The brightness of an element is set to 105% of default brightness using this class. Equivalent to CSS brightness(1.05).
- backdrop-brightness-110 – The brightness of an element is set to 110% of default brightness using this class. Equivalent to CSS brightness(1.10).
- backdrop-brightness-125 – The brightness of an element is set to 125% of default brightness using this class. Equivalent to CSS brightness(1.25).
- backdrop-brightness-150 – The brightness of an element is set to 150% of default brightness using this class. Equivalent to CSS brightness(1.50).
- backdrop-brightness-200 – The brightness of an element is set to 200% of default brightness using this class. Equivalent to CSS brightness(2.0).
Syntax:
<element class="backdrop-filter backdrop-brightness-{amount}"> .. </element>
Tailwind Backdrop Brightness Example: 1 
Tailwind Backdrop Brightness Example: 2 
Tailwind Backdrop Brightness Example: 3 
Example Explaination
In Above example we are using the “backdrop-brightness” property to adjust the brightness of the area behind an element.
The code starts with the declaration of a doctype for HTML5 and then defines an HTML document that contains a head section and a body section.
In the head section, a link to a script file on a CDN (content delivery network) is included. This script file provides access to the Tailwind CSS framework.
- In the body section, a heading, a paragraph, and a container with a background image are defined.
- The container includes a set of three child elements, each with different Tailwind CSS classes applied.
- These classes use the “backdrop-filter” property to apply a brightness effect to the background image.
- The child elements have different brightness values applied using the “backdrop-brightness” property with different values (75, 100, 150), resulting in a range of different brightness levels.
Overall, above examples demonstrates how to use Tailwind Backdrop Brightness class to adjust the brightness of the area behind an HTML element, creating a visually appealing design.