gpt4 book ai didi

css - 我可以将 CSS 过滤器应用于背景图像吗?

转载 作者:技术小花猫 更新时间:2023-10-29 11:35:47 24 4
gpt4 key购买 nike

我想在背景中放一张像这样的照片

body{

background-color: transparent !important;
background-image: url("img.jpg");
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
filter: blur(5px);
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px)


}

还有一个模糊滤镜。

但是,当我把它放在 body 上时,除了背景图像之外的所有东西都模糊了。

有没有办法只在背景图像上应用模糊? (除了在 photoshop 或类似软件中进行模糊处理。

最佳答案

Blur 将作用于除 body 之外的任何容器的背景图像。

filter: blur(20px)

演示在这里

https://jsfiddle.net/scheinercc/Yr2zD/1128/

关于css - 我可以将 CSS 过滤器应用于背景图像吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13526083/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com