Drop Shadow For Png Image in Css

Can you add a non-square drop shadow to PNG content with CSS?

It's definitely possible.

Using filters, sample:

img { 
-webkit-filter: drop-shadow(5px 5px 5px #222);
filter: drop-shadow(5px 5px 5px #222);
}

How to make a rounded drop shadow on a png image

for rounded drop shadow you can use radial-gradient in background with transparent image.

original image used in snippet is original image
Please refer snippet.

body{background-color: black}img {
/* For browsers that do not support gradients */ background-image: radial-gradient(circle, white, black, black); padding: 50px;}
<body>
<img src="https://vignette.wikia.nocookie.net/fantendo/images/a/ae/250px-Captain_Falcon_SSB4.png" /></body>

box shadow issue with transparent parts of an image

You can use filter with drop-shadow.

Check out the supported browsers in this list.

.framed-image {  background: url("https://cdn.pbrd.co/images/HfNQr1M.png") no-repeat;  background-size: cover;  padding: 18px;  object-fit: cover;}
.image-menu { width: 300px; height: 200px; background-size: 100% 100% !important; filter: drop-shadow(0 3px 8px rgb(136, 136, 136));}
<div class="image-menu-parent">  <img class="framed-image image-menu" src="http://placehold.it/1/365f83"></div>

Possible to create a css shadow on transparent background PNG image?

If you load the image in to a canvas context you can do this.

good clean source here:

http://philip.html5.org/demos/canvas/shadows/various.html



Related Topics



Leave a reply



Submit