--- name: tailwindcss-effects description: "Effects utilities Tailwind CSS v4.1. Shadows (shadow-*, shadow-color, inset-shadow-* NEW), Opacity (opacity-*), Filters (blur, brightness, contrast, grayscale, sepia), Backdrop filters (backdrop-blur-*, backdrop-brightness-*), Masks (mask-* NEW)." user-invocable: false --- # Tailwind CSS v4.1 Effects Effects utilities to add shadows, filters, masks and visual effects to elements. ## Box Shadow ### Shadows Standard ```html
No shadow
Extra small shadow
Small shadow
Base shadow
Medium shadow
Large shadow
Extra large shadow
2XL shadow
``` ### Shadow Color (v4.1 NEW) ```html
Red tinted shadow
Blue tinted shadow
Purple shadow with opacity
``` ### Inset Shadow (v4.1 NEW) ```html
Inset small shadow
Inset base shadow
Inset large shadow
Inset shadow with color
``` ### Arbitrary Shadow Values ```html
Custom shadow
Custom inset
``` ## Opacity ### Opacity Utilities ```html
Fully transparent
25% opacity
50% opacity
75% opacity
Fully opaque
``` ### Opacity with Colors ```html
Red with 50% opacity
Text with 75% opacity
Border with 25% opacity
Shadow with 30% opacity
``` ## Filters ### Blur ```html
No blur
Small blur (4px)
Base blur (12px)
Medium blur (16px)
Large blur (24px)
Extra large blur (40px)
2XL blur (64px)
Custom blur 8px
``` ### Brightness ```html
Darken to 50%
Darken to 75%
Normal (100%)
Brighten to 125%
Brighten to 150%
Brighten to 200%
``` ### Contrast ```html
Reduce contrast 50%
Reduce contrast 75%
Normal contrast (100%)
Increase contrast 125%
Increase contrast 150%
Increase contrast 200%
``` ### Grayscale ```html
No grayscale
Full grayscale (100%)
50% grayscale
``` ### Sepia ```html
No sepia
Full sepia (100%)
75% sepia
``` ### Hue Rotate ```html
No rotation
15 degree rotation
30 degree rotation
60 degree rotation
90 degree rotation
180 degree rotation
Custom rotation
``` ### Invert ```html
No invert
Full invert (100%)
50% invert
``` ### Saturate ```html
Desaturate to 50%
Normal saturation (100%)
Increase saturation 150%
Increase saturation 200%
``` ## Backdrop Filters Applies filters to the backdrop (element behind). ### Backdrop Blur ```html
No blur
Small blur (4px)
Base blur (12px)
Medium blur (16px)
Large blur (24px)
Extra large blur (40px)
``` ### Backdrop Brightness ```html
Darken backdrop 50%
Darken backdrop 75%
Normal (100%)
Brighten backdrop 125%
Brighten backdrop 150%
``` ### Backdrop Contrast ```html
Reduce backdrop contrast 50%
Normal (100%)
Increase backdrop contrast 150%
``` ### Backdrop Grayscale ```html
No grayscale
Full grayscale (100%)
``` ### Backdrop Invert ```html
No invert
Full invert (100%)
``` ### Backdrop Saturate ```html
Desaturate backdrop 50%
Normal (100%)
Increase backdrop saturation 150%
``` ### Backdrop Sepia ```html
No sepia
Full sepia (100%)
``` ## Mask (v4.1 NEW) ### Mask Image ```html
No mask applied
Linear gradient mask (top to bottom)
Radial gradient mask (center)
Custom mask
``` ### Mask Position ```html
Center mask
Top mask
Bottom mask
Left mask
Right mask
``` ### Mask Size ```html
Contain mask
Cover mask
Auto mask size
Custom size
``` ### Mask Repeat ```html
Repeat mask
Repeat horizontally
Repeat vertically
No repeat
``` ## Combined Effects ### Blur + Brightness ```html
Blurred and darkened
``` ### Shadow + Opacity ```html
Shadow with tint and opacity
``` ### Backdrop Blur + Brightness ```html
Frosted glass effect
``` ### Inset Shadow + Grayscale ```html
Pressed effect with grayscale
``` ## Responsive Effects ```html
Responsive blur
Responsive opacity
Frosted glass on desktop
``` ## Dark Mode ```html
Darker shadow in dark mode
More visible in dark mode
Less blur in dark mode
``` ## Configuration (v4.1) ### CSS Theme Variables ```css @import "tailwindcss"; @theme { --color-shadow: #000; --blur-custom: 20px; } ``` ### Custom Effects ```css @utility glass-effect { @apply backdrop-blur-md backdrop-brightness-90 opacity-90; } @utility glow { box-shadow: 0 0 20px var(--color-cyan-500); } ``` ## Real-world Examples ### Modal with frosted backdrop ```html
``` ### Card with elevated shadow ```html
Card with subtle colored shadow
``` ### Image with fade-out mask ```html
Fading image
``` ### Glassmorphism component ```html
Glass effect container
``` ## Browser Support - **Shadows**: All modern browsers - **Filters**: Chrome 18+, Firefox 35+, Safari 6+ - **Backdrop filters**: Chrome 76+, Safari 9+, Firefox 103+ - **Masks**: Chrome 1+, Safari 4+, Firefox 53+ - **Opacity**: All modern browsers ## Performance Tips 1. Use backdrop-blur sparingly - heavy performance impact 2. Prefer opacity for transparency over rgba colors 3. Use inset-shadow instead of multiple box-shadows for layering 4. Combine related effects in custom utilities to reduce class count 5. Test backdrop effects on low-end devices ## References - [shadows.md](references/shadows.md) - Detailed shadow configuration - [filters.md](references/filters.md) - Filter effects reference - [opacity.md](references/opacity.md) - Opacity and transparency