Help me on how to add a shadow to an element in CSS.
How to add a shadow to an element in CSS ?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Help me on how to add a shadow to an element in CSS.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mohamed Azarudeen ZRank #297 · 8.5K reputationPosted May 10, 2023, 10:41 AM EDT
Hi
try this
.my-element { box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); }Deepak RawatRank #646 · 3.7K reputationPosted May 13, 2023, 3:17 PM EDT
div { width: 300px; height: 100px; padding: 15px; background-color: coral; box-shadow: 10px 10px 5px lightblue; } The box-shadow Property A div element with a 5px blurred, lightblue box-shadow.Tuhin PaulRank #7 · 71.9K reputationPosted May 15, 2023, 1:04 PM EDT
Below are the steps to add a shadow to an element in CSS:
1. Select the element you want to add a shadow to.
2. Add the following CSS property to the element:
box-shadow: ;