HTML CSS Bootstrap JavaScript jQuery MySQL PHP Data Mining

CSS Shadows

Shadows add depth and realism to your web designs. CSS provides two main properties: box-shadow for elements and text-shadow for typography.


1. The box-shadow Property

The box-shadow property attaches one or more shadows to an element.

/* box-shadow: h-offset v-offset blur spread color; */
.box {
    box-shadow: 10px 10px 5px lightgrey;
}
Simple Drop Shadow
Outer Glow Effect
Inset Inner Shadow

2. The text-shadow Property

This property adds shadows to the letters of a word.

Styled Text Shadow
.title {
    text-shadow: 2px 2px 8px #ff0000;
}

Multiple Shadows

You can comma-separate shadows to add more than one to the same element.

.neon {
    box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #2e7d52;
}

Tip: Subtlety is key with shadows. Instead of pure black (#000), use semi-transparent colors like rgba(0,0,0,0.1) for a more natural, modern look.