CSS (Cascading Style Sheet) allows us to do various adjustments in HTML. Here I am going to explain you how to give a drop shadow effect behind the images using simple CSS syntax. Just adding a little shadow behind images can rock the looks of your layout of site and really this is a best method of encouraging users to focus on site images.
Suppose your site have several images and all the images have single property of CSS then you can try the code given below. This will add a clear drop shadow at every single sides of the image.
-webkit-box-shadow: 0px 0px 8px 2px;
-moz-box-shadow: 0px 0px 8px 2px;
box-shadow: 0px 0px 8px 2px;
Here first two PX defines the shadow range horizontally and vertically where other two PX defines the shadow blur and show depth.
[ 0px opx 8px 2px = (Horizontal) (Vertical) (Blur) (Depth) ]
If you want a specific color of shadow then you can also add colors to this shadow by adding a HEX Color code in front of all the syntaxes. Here for demonstration I am using Green (#008800) Hex code.
-webkit-box-shadow: 0px 0px 8px 2px #008800;
-moz-box-shadow: 0px 0px 8px 2px #008800;
box-shadow: 0px 0px 8px 2px #008800;
By this way you can apply a drop shadow behind any images that you want using this simple CSS code. This will not only gives a better looks but also attacks the visitors to look at you images.
2 responses to “How to Give Drop Shadow Behind Images Using CSS”
Its not working
In order to make your images get this shadow you need to first specify the image’s tag.