html - css 过滤器 : blur frosting glass effect not working, 没有模糊,内容受到影响

标签 html css background-color blur

我想要一张背景照片,前面有一个 div。 div 应具有模糊的深色背景和白色文本。

但它目前正在做的是:没有模糊的深色背景和深色文本。 请帮助我!

#section0 {
background-color: lightgreen; /*normally the photo*/
}

.blurwrapper {
position: relative;
overflow: hidden;
}

.blur {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: black;
filter: blur(1px);
opacity: 0.2;
transform: scale(1.5);
z-index: 1;
}

h1 {
color: white;
}
.about {
color: white;
background: none;
margin: auto;
margin-top: 20px;
max-width: 800px;
font-size: 15px;
padding: 20px;
text-align: center;
letter-spacing: 2px;
color: white;
border-top: 1px solid white;
z-index: 2;
}
<div class="section active" id="section0">
    <div class="blurwrapper">
      <h1><span>...</span></h1>
      <p class="about">...</p>
      <div class="blur"></div>
    </div>
</div>

最佳答案

如您所见,模糊滤镜已应用于当前元素。 这意味着如果您想模糊图像,您需要将模糊应用到设置了 background-image#section0 容器。如果您有颜色而不是图像,您只会看到模糊的边框。

有关更多信息,请查看文档。 https://developer.mozilla.org/en-US/docs/Web/CSS/filter

使用您的代码给出更清晰的示例:http://codepen.io/ThePeach/full/egYbbe/

关于html - css 过滤器 : blur frosting glass effect not working, 没有模糊,内容受到影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41460211/

相关文章:

asp.net - 我可以使用 <asp :Image's? 使用 asp.net 图像从这些图像制作 Sprite 图像吗

css - 如何通过 AJAX 从不同来源获取 CSS 文件?

background - 如何在没有 "window-blind effect"的情况下在覆盖整个页面的页面上设置渐变背景?

jquery - 响应式导航在响应模式下激活时搞砸了,然后再次调整大小

javascript - 尽管 CSS 相同,但 Firefox 中的搜索框更高

javascript - 在 jquery 中滑动元素时出现问题?

iphone - 表格单元格颜色不适用于披露指示器后面

javascript - 根据一些集合创建随机颜色的方法

javascript - jQuery .text() 不会更新

javascript - 使用nodejs和express不断出现404错误