<div class="main">
<p>CSS-only shader with text-clip. Scroll Down ⬇️</p>
<h1 class="metal">
METAL
<span class="texture"></span>
</h1>
<p>For more on this technique, check out <a target="_blank" href="https://robbowen.digital/wrote-about/css-blend-mode-shaders/">Holograms, light-leaks and how to build CSS-only shaders.</a></p>
<p><a target="_blank" href="https://unsplash.com/photos/v6uiP2MD6vs">Metal image</a> by <a target="_blank" href="https://unsplash.com/@etiennemartin">Etienne Martin on unsplash</a></p>
</div>
body {
/* Metal by Etienne Martin. https://unsplash.com/photos/v6uiP2MD6vs */
--metal-tex: url(https://images.unsplash.com/photo-1501166222995-ff31c7e93cef?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTcyMDc2NzU&ixlib=rb-1.2.1&q=80);
background: black;
color: white;
font-family: system-ui, sans-serif;
}
a {
color: skyblue;
font-weight: bold;
}
.main {
margin: 40px auto;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.metal {
position: relative;
margin: 15vh auto;
color: transparent;
font-family: impact, sans-serif;
font-size: 25vw;
letter-spacing: 0.05em;
background-image: var(--metal-tex);
background-size: cover;
background-clip: text;
background-clip: text;
}
.texture,
.texture::after {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.texture {
background-image: linear-gradient(to bottom, blue, white 50%, red 65%, white);
background-attachment: fixed;
mix-blend-mode: color-dodge;
}
.texture::after {
content: '';
background-image: var(--metal-tex);
background-size: cover;
filter: saturate(0) brightness(0.8) contrast(4);
mix-blend-mode: multiply;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.