我有一个带有背景图像的 div。背景图片css设置如下:
.resPic1 {
background: url(../css/images/residentialpic1.jpeg) center;
background-size: contain;
}
What i want to know is if there is a way to only blur the repeated images (the repeated images that are outside the blue lines i've highlighted in my picture) any help is appreciated!
如果您的图像有模糊版本,您可以通过在元素上应用多个背景图像来实现:
body {
/* place the blurred image below the normal one */
background-image:
url("https://upload.wikimedia.org/wikipedia/commons/5/55/John_William_Waterhouse_A_Mermaid.jpg"),
url("http://dl.dropboxusercontent.com/s/z3icpq9rkrf4rac/blurred_10px_mermaid.png?dl=0");
/* repeat only the blurred one */
background-repeat: no-repeat, repeat;
background-position: center, center;
background-size: contain;
width: 100vw;
height: 100vh;
}
如果你不这样做,一点点::before
+::after
hack 也可以做到:
body{
width: 100vw;
height: 100vh;
margin: 0;
}
body::before, body::after{
content: "";
background-image: url("https://upload.wikimedia.org/wikipedia/commons/5/55/John_William_Waterhouse_A_Mermaid.jpg");
background-position: center;
background-size: contain;
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0px;
left: 0px;
}
/* the blurred image */
body::before{
content: "";
background-repeat: repeat;
filter: blur(3px);
}
/* the clear image */
body::after{
content: "";
background-repeat: no-repeat;
z-index: 1;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)