给不规则png图片内容添加阴影

一般加阴影使用的是box-shadow属性,但是它只能给盒子边框添加阴影,不能更具图片形状来添加阴影,这时候需要使用filter:drop-shadow()过滤镜功能,可以在实现图像的内容上创建阴影。

使用box-shadow属性效果
在这里插入图片描述

使用filter:drop-shadow()过滤镜效果
在这里插入图片描述

参考地址:https://www.shejiku.net/pngtpyyxs.html

filter还有其他属性值如filter:blur(1px);实现高斯模糊效果
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44801790/article/details/128134610