📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials CSS Mastery Shadows

Shadows

4 min read
box-shadow adds a shadow: box-shadow: 4px 4px 8px rgba(0,0,0,0.2). Use inset for inner shadows. Layer multiple shadows with commas. filter: drop-shadow() works on irregular shapes like transparent PNGs.

Shadows

/* box-shadow: x y blur spread color */
.card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15), /* layered */
                0 1px 3px  rgba(0,0,0,0.08);
}

/* Inset shadow (inside element) */
input:focus {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* Text shadow */
h1 {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}