【发布时间】:2019-04-16 10:32:12
【问题描述】:
编辑:添加 codepen 链接
我目前正在尝试使用 CSS 获得磨砂玻璃效果,但是我尝试的所有方法都只是产生了轻微的色调。
这正在 Chrome 中进行测试。
body {
font: 15px/1.5 Arial, Helvetica, sans-serif;
padding: 0;
margin: 0;
background: url("https://i.imgur.com/ht1etAo.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
.frost {
color: #ffffff;
width: 400px;
height: 200px;
position: absolute;
background: inherit;
overflow: hidden;
margin: 0 auto;
padding: 2rem;
}
.frost:before {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: inherit;
filter: blur(20px);
box-shadow: inset 0 0 3000px rgba(255, 255, 255, 0.5);
margin: -20px;
}
<section id="frontImage">
<div class="container">
<div class="frost">
<h3>Testing Glass</h3>
</div>
</div>
</section>
filter 属性似乎并没有真正起作用,因为更改它实际上不会影响 div。
这是我的代码:我正在尝试模糊霜 div
针对这种效果:https://codepen.io/AmJustSam/full/ModORY/
我有什么:https://codepen.io/anon/pen/PxWEde
我也尝试过使用 webkit-blur,但也没有用。
非常感谢任何建议。如果需要更多信息,请询问。
【问题讨论】:
-
你能提供一个 jsfiddle/codepen 或类似的东西来代替截图吗?另外我不太明白你想要的结果是什么,你能详细说明一下吗?
-
您不想将过滤器应用于正文(具有背景图像)吗?
-
目前您正在将过滤器应用于前元素,这只是模糊了盒子阴影。您究竟想模糊什么,背景图像或“测试玻璃”元素?
-
我想模糊框后面的背景我添加了代码笔以显示所需的结果