Shadows & Effects
Shadows give elements depth and show which things sit "above" others. Tailwind also has effect utilities for opacity, blend modes, text shadows and masks.
Box shadows
| Class | Look | v3 name |
|---|---|---|
shadow-2xs |
barely there | — (new) |
shadow-xs |
very subtle | shadow-sm |
shadow-sm |
subtle | shadow |
shadow-md |
medium | same |
shadow-lg |
large, soft | same |
shadow-xl / shadow-2xl |
floating | same |
shadow-none |
remove the shadow | same |
Note: v4 shifted the small sizes down one step so every size has an explicit name. When upgrading, v3
shadow-smbecomesshadow-xsand bareshadowbecomesshadow-sm.
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="grid grid-cols-4 gap-4 bg-slate-100 p-6 text-center text-xs">
<div class="rounded-lg bg-white p-4 shadow-xs">xs</div>
<div class="rounded-lg bg-white p-4 shadow-sm">sm</div>
<div class="rounded-lg bg-white p-4 shadow-md">md</div>
<div class="rounded-lg bg-white p-4 shadow-lg">lg</div>
<div class="rounded-lg bg-white p-4 shadow-xl">xl</div>
<div class="rounded-lg bg-white p-4 shadow-2xl">2xl</div>
<div class="rounded-lg bg-white p-4 inset-shadow-sm">inset-shadow-sm</div>
<div class="rounded-lg bg-white p-4 shadow-none">none</div>
</body>
</html>Coloured shadows
Add a colour (with optional opacity) to tint the shadow. Coloured shadows look great under brightly coloured buttons.
| Class | Effect |
|---|---|
shadow-lg shadow-indigo-500/50 |
large indigo glow at 50% |
inset-shadow-sm inset-shadow-black/20 |
inner shadow colour |
shadow-lg/20 |
change only the shadow's opacity (v4.1) |
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="flex flex-wrap items-center gap-6 p-8">
<button class="rounded-xl bg-indigo-500 px-5 py-3 font-semibold text-white shadow-lg shadow-indigo-500/50">Indigo glow</button>
<button class="rounded-xl bg-pink-500 px-5 py-3 font-semibold text-white shadow-xl shadow-pink-500/40">Pink glow</button>
<button class="rounded-xl bg-emerald-500 px-5 py-3 font-semibold text-white shadow-lg shadow-emerald-700/60 hover:shadow-xl">Hover me</button>
</body>
</html>Opacity
opacity-* makes a whole element (including its children) transparent: opacity-0, opacity-25, opacity-50, opacity-75, opacity-100 — and in v4 any number such as opacity-35.
Tip: To fade only a background and keep the text solid, use a colour modifier like
bg-black/50instead ofopacity-50.
Text shadows (v4.1)
Tailwind v4.1 added text-shadow-2xs through text-shadow-lg, which can be coloured just like box shadows.
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="space-y-3 bg-sky-100 p-6">
<p class="text-3xl font-bold text-white text-shadow-md">Readable white text</p>
<p class="text-3xl font-bold text-sky-950 text-shadow-lg text-shadow-sky-400">Coloured shadow</p>
<p class="text-3xl font-black text-white text-shadow-[0_0_10px_rgb(236_72_153)]">Neon glow</p>
</body>
</html>Blend modes and masks
| Class | CSS |
|---|---|
mix-blend-multiply / mix-blend-screen / mix-blend-overlay … |
mix-blend-mode (element over what's behind it) |
bg-blend-multiply … |
background-blend-mode (between background layers) |
mask-b-from-50% |
fade the element out towards the bottom (v4.1) |
mask-radial-from-40% |
radial fade from the centre (v4.1) |
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="flex gap-8 p-6">
<div class="isolate flex">
<div class="size-24 rounded-full bg-cyan-400 mix-blend-multiply"></div>
<div class="-ml-10 size-24 rounded-full bg-yellow-300 mix-blend-multiply"></div>
<div class="-ml-10 size-24 rounded-full bg-fuchsia-400 mix-blend-multiply"></div>
</div>
<div class="h-28 w-40 bg-linear-to-br from-violet-600 to-sky-400 p-3 text-white mask-b-from-40%">
This box fades out at the bottom.
</div>
</body>
</html>Where the circles overlap, mix-blend-multiply mixes their colours like ink. isolate keeps the blending inside that group.
Test yourself
You are upgrading from v3. What should shadow (no size) become in v4?
shadow-xsshadow-smshadow-md- It stays
shadow
How do you give a large shadow a 50% indigo tint?
shadow-lg-indigo-50shadow-lg shadow-indigo-500/50shadow-lg text-indigo-500shadow-indigo shadow-50
What is the difference between opacity-50 and bg-black/50?
- None
opacity-50fades the whole element including text;bg-black/50only fades the backgroundbg-black/50fades the textopacity-50only works on images