图片的模糊效果
先看效果对比

代码设置

项目中的应用
描述:背景是一张模糊的图片,同时有一个半透明蒙层

实现方法
html部分代码:

header是最外层的盒子,样式为

然后设置背景图的样式

当不给header添加overflow:hidden属性的时候,由于我们给背景图片使用了filter属性会导致背景图的阴影溢出,如下图

所以需要给header添加overflow:hidden属性

以上是自己在项目实践中的实现方法,大家有其他的方法实现的欢迎来讨论,指导!
图片的模糊效果
先看效果对比
代码设置
项目中的应用
描述:背景是一张模糊的图片,同时有一个半透明蒙层
实现方法
html部分代码:
header是最外层的盒子,样式为
然后设置背景图的样式
当不给header添加overflow:hidden属性的时候,由于我们给背景图片使用了filter属性会导致背景图的阴影溢出,如下图
所以需要给header添加overflow:hidden属性
以上是自己在项目实践中的实现方法,大家有其他的方法实现的欢迎来讨论,指导!
本文标题:filter:blur()实现图片模糊效果
本文链接:https://www.haomeiwen.com/subject/kuatsftx.html
网友评论