Web Analytics

CSS Shadows

Beginner ~8 min read

Box Shadow Basics

box-shadow adds shadows to elements. Syntax: x-offset y-offset blur spread color.

HTML
CSS
JS

Inset Shadows

Add inset keyword for inner shadows, creating a pressed or recessed effect.

HTML
CSS
JS

Multiple Shadows

Stack multiple shadows by separating them with commas for complex effects.

HTML
CSS
JS

Colored Shadows

Use any color for shadows, not just black! Great for creating glowing effects.

HTML
CSS
JS

Text Shadow

text-shadow adds shadows to text. Syntax: x-offset y-offset blur color.

HTML
CSS
JS
Pro Tip: Use subtle shadows (low opacity, small blur) for modern, clean designs. Avoid heavy shadows unless going for a specific dramatic effect!

Summary

  • box-shadow - Shadows for elements
  • Syntax: x y blur spread color
  • inset - Inner shadows
  • Multiple shadows - Separate with commas
  • text-shadow - Shadows for text
  • Use rgba() for transparent shadows

Quick Quiz

Which keyword creates an inner shadow?

A
inner
B
inset
C
inside
D
internal