Pseudo Element clipping over text

I have an H1 tag that is currently outlined. I'm trying to add a Pseudo element which fills the color with white (to get rid of outline). The goal is to make a hover fill effect. Any tips? Thanks!
No description
19 Replies
clevermissfox
clevermissfoxβ€’11mo ago
Why not just fill in the color of the h1 on hover? Why a pseudo element ?
Matt
MattOPβ€’11mo ago
I wanted to make the color come in starting from the bottom
dys πŸ™
dys πŸ™β€’11mo ago
Animate a linear gradient on the h1.
Matt
MattOPβ€’11mo ago
Hmm let me try that
clevermissfox
clevermissfoxβ€’11mo ago
I was literally just thinking that!
Matt
MattOPβ€’11mo ago
I might be doing this wrong
h1:hover {
animation: changeColor 1000ms;
}

@keyframes changeColor {
from {
background: linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 0%);
background-clip: text;
-webkit-background-clip: text;
}

to {
background: linear-gradient(0deg, rgba(255,255,255,1) 100%, rgba(255,255,255,0) 100%);
background-clip: text;
-webkit-background-clip: text;
}
}
h1:hover {
animation: changeColor 1000ms;
}

@keyframes changeColor {
from {
background: linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 0%);
background-clip: text;
-webkit-background-clip: text;
}

to {
background: linear-gradient(0deg, rgba(255,255,255,1) 100%, rgba(255,255,255,0) 100%);
background-clip: text;
-webkit-background-clip: text;
}
}
Matt
MattOPβ€’11mo ago
it goes away as soon as animation is done
dys πŸ™
dys πŸ™β€’11mo ago
Try:
h1:hover {
animation: 1000ms linear changeColor;
}
h1:hover {
animation: 1000ms linear changeColor;
}
Matt
MattOPβ€’11mo ago
I had that originally Still is a harsh transition
Matt
MattOPβ€’11mo ago
I'm trying to have this kind of effect, but for filling the color
Matt
MattOPβ€’11mo ago
Envato Tuts+
CodePen
CSS Hover Effect: Techniques for Creating a Text Fill Wipe
In today’s tutorial, we’ll learn two different techniques for creating a fill text effect on hover. We’ll even go one step further and give ourselves t...
dys πŸ™
dys πŸ™β€’11mo ago
I was gonna say, most of the examples I've seen involve changing the background-position.
Matt
MattOPβ€’11mo ago
I tried to do that with the gradient as well but didn't seem to fix. Still won't transition properly
dys πŸ™
dys πŸ™β€’11mo ago
Did you look at the link?
Matt
MattOPβ€’11mo ago
Yeah, it seems to be doing it entirely different
dys πŸ™
dys πŸ™β€’11mo ago
It's got a background that's twice as tall as the text which is half red & half transparent & is changing its position.
Matt
MattOPβ€’11mo ago
Ohh I was looking at the link I sent completely missed yours Interesting thanks for making that codepen
Want results from more Discord servers?
Add your server