JSFiddle - React, Tailwind, and code Playground
by 규연 황
HTML
<nav>
<div class="backdrop"></div>
</nav>
<div class="container">
<p>Lorem ipsum dolor</p>
</div>
CSS
body {
padding: 150px 10px 0;
}
nav {
position: fixed;
top: 0;
left: 0;
width: 100%;
/* height: 50px; */
}
.backdrop {
position: absolute;
inset: 0;
--extendy: 80px;
bottom: calc(-1 * var(--extendy));
--cutoff: calc(100% * var(--extendy));
-webkit-mask-image: linear-gradient(
to bottom,
black 0,
black var(--cutoff),
transparent var(--cutoff)
);
height: 100px;
background: rgba(255, 255, 255, 0.5);
--blur: 15px;
-webkit-backdrop-filter: blur(var(--blur));
backdrop-filter: blur(var(--blur));
}
.container {
height: 200vh;
}
p {
font-size: 40px;
font-weight: 900;
}