:: before - element out of position
I am trying to reproduce this frosted glass effect ( frosted glass , codepen ).
My problem is that I cannot get the blurred area. It always looks slightly offset to the right (see jsfiddle ).
<!doctype html>
<head>
<style>
html, body, .glass {
width: 100%;
height: 100%;
overflow: hidden;
}
body {
background-image: url('pelican.jpg');
background-size: cover;
}
.glass::before {
display: block;
width: 100%;
height: 100%;
background-image: url('pelican.jpg');
-webkit-filter: blur(5px);
background-size: cover;
content: ' ';
opacity: 0.4;
}
.glass {
background-color: white;
}
.glass.down {
transform: translateY(100%) translateY(-20rem);
}
.glass.down::before {
transform: translateY(-100%) translateY(20rem);
}
.glass.up, .glass.up::before {
transform: translateY(0);
}
</style>
</head>
<body>
<article class="glass down">
<h1>Pelican</h1>
<p>additional content...</p>
</article>
</body>
</html>
I'm pretty sure this is just a small detail I'm missing here, but I just don't find it.
+3
source to share