Shadows add depth and realism to your web designs. CSS provides two main properties: box-shadow for elements and text-shadow for typography.
box-shadow PropertyThe 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;
}
text-shadow PropertyThis property adds shadows to the letters of a word.
.title {
text-shadow: 2px 2px 8px #ff0000;
}
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;
}
#000), use semi-transparent colors like rgba(0,0,0,0.1) for a more natural, modern look.