【发布时间】:2021-04-08 10:52:33
【问题描述】:
在尝试 glassmorphism 样式并使用 css 背景过滤器时,我在滚动时在元素顶部看到一个深色模糊边缘。我觉得这应该很容易解决,但我已经尝试了我所知道的一切(这显然还不够)并且无法弄清楚。我创建了一支笔,以便您可以看到我在说什么。由于某些令人困惑的原因,您必须在 codepen 中打开它才能看到不希望的效果。
body {
background-image: url("https://www.theuiaa.org/wp-content/uploads/2017/12/2018_banner.jpg");
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
height: 200vh;
background-color: rgba(255, 255, 255, 0.5);
background-blend-mode: soft-light;
}
.container {
display: flex;
align-items: center;
justify-content: center;
height: 50%;
}
.card {
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: column;
width: 320px;
height: 540px;
background: rgba(255, 255, 255, 0.3);
backdrop-filter: blur(15px);
}
.arrow {
position: sticky;
top: 0px;
font-size: 200px;
line-height: 1;
color: red;
}
.card p {
font-size: 32px;
padding: 20px;
}
<div class="container">
<div class="card">
<div class="arrow"><span>🠑</span></div>
<p>As you can see when you scroll down, as soon as the card hits the top of the screen, you get a blurred edge. Not cool...</p>
</div>
</div>
【问题讨论】:
标签: css filter scroll blur blurry