The Drop Shadow class is used to apply a filter to the image to set the shadow of the image. This class creates a blurred shadow in a given offset and color. In CSS, we do that by using the CSS drop-shadow() Function. Tailwind CSS newly added feature brightness in 2.1 version.
Drop Shadow:
- drop-shadow-sm: This class is used to set the small shadow effect.
- drop-shadow: This class is used to set the normal shadow effect.
- drop-shadow-md: This class is used to set the medium shadow effect.
- drop-shadow-lg: This class is used to set the large shadow effect.
- drop-shadow-xl: This class is used to set the extra-large shadow effect.
- drop-shadow-2xl: This class is used to set the double extra large shadow effect.
- drop-shadow-none: This class is used to remove the shadow effect.
Syntax:
<element class="filter drop-shadow-{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 Drop Shadow Class</ b >
< div class = "grid grid-flow-col text-center p-4" >
< img class = "rounded-lg filter drop-shadow-sm" src =
alt = "image" >
< img class = "rounded-lg filter drop-shadow" src =
alt = "image" >
< img class = "rounded-lg filter drop-shadow-md" src =
alt = "image" >
< img class = "rounded-lg filter drop-shadow-lg" src =
alt = "image" >
< img class = "rounded-lg filter drop-shadow-2xl" src =
alt = "image" >
</ div >
</ body >
</ html >
|
Output: