<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> .myproduct1{ box-shadow:0px 0px 55px 2px rgba(162, 162, 160,0.8) inset; display:inline-block; } .myproduct1 img{ z-index: -1; position:relative; } .img-shadow { position: relative; max-width: 100%; overflow:hidden; display:inline-block; } .img-shadow:before { content: ""; position: absolute; top: 0; bottom: 0; left: -44px; right: -44px; box-shadow: inset 0 0 44px 5px rgba(192, 188, 187,1); -moz-box-shadow: inset 0 0 44px 5px rgba(192, 188, 187,1); -webkit-box-shadow: inset 0 0 44px 5px rgba(192, 188, 187,1); } .img-shadow1 { position: relative; max-width: 100%; display:inline-block; } .img-shadow1:before { content: ""; position: absolute; top: 0; left: 0; right: 0; height:25px; background:linear-gradient(rgba(192, 188, 187,0.5), rgba(192, 188, 187,0)); } .img-shadow1:after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height:25px; background:linear-gradient(rgba(192, 188, 187,0), rgba(192, 188, 187,0.5)); } </style> </head> <body> <div class="myproduct1" > <img src="https://www.netmeds.com/media/catalog/product/big/14328.jpg" width="226" height="228"/> </div> </br> </br> Using box shadow with before element stretching outside the container and hiding outside part using overflow hidden.</br> I prefer this concept but if you increase the share then you need to also increase the left and right values accordingly <a href="#" class="img-shadow"><img src="https://www.netmeds.com/media/catalog/product/big/14328.jpg" width="226" height="228" /></a> </br> </br> Using before and after elements aligned to top and bottom with fixed height and gradient background </br> <a href="#" class="img-shadow1"><img src="https://www.netmeds.com/media/catalog/product/big/14328.jpg" width="226" height="228" /></a> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more