How to Add Shadow in a DIV using CSS ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to Add Shadow in a DIV using CSS ?

@saurav_kumawat @i_m_srv_

14th Mar 2017, 4:16 PM
Digital Saurav
Digital Saurav - avatar
4 Answers
+ 2
eg. box-shadow: 1px solid #999;
14th Mar 2017, 4:33 PM
Digital Saurav
Digital Saurav - avatar
+ 1
<div class="classname">CONTENT</div> In CSS: .classname { height: 50px; width: 50%; background-color: lightblue; box-shadow: 2px 2px 2px rgba(0,0,0,1); } First number is the X offset. Second is Y. Third is the spread. RGBA is the color (with alpha) of your choice. 1 is opaque. 0 is transparent. You can also switch the class with id by changing class to id, and the '.' selector to a # (i.e. from .classname{} to #classname{} ) Feel free to play with it here: https://jsfiddle.net/Lowtn2qw/
14th Mar 2017, 4:22 PM
Joel Hager
Joel Hager - avatar
0
use box-shadow
14th Mar 2017, 4:18 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
try box-shadow: 0 0 4px 4px #456aaa 1px solid #999 - its for borders :)
14th Mar 2017, 4:34 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar