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β€’7mo ago
Why not just fill in the color of the h1 on hover? Why a pseudo element ?
Matt
Mattβ€’7mo ago
I wanted to make the color come in starting from the bottom
dysbulic πŸ™
dysbulic πŸ™β€’7mo ago
Animate a linear gradient on the h1.
Matt
Mattβ€’7mo ago
Hmm let me try that
clevermissfox
clevermissfoxβ€’7mo ago
I was literally just thinking that!
Matt
Mattβ€’7mo 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
Mattβ€’7mo ago
it goes away as soon as animation is done
dysbulic πŸ™
dysbulic πŸ™β€’7mo ago
Try:
h1:hover {
animation: 1000ms linear changeColor;
}
h1:hover {
animation: 1000ms linear changeColor;
}
Matt
Mattβ€’7mo ago
I had that originally Still is a harsh transition
Matt
Mattβ€’7mo ago
I'm trying to have this kind of effect, but for filling the color
Matt
Mattβ€’7mo 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...
dysbulic πŸ™
dysbulic πŸ™β€’7mo ago
I was gonna say, most of the examples I've seen involve changing the background-position.
Matt
Mattβ€’7mo ago
I tried to do that with the gradient as well but didn't seem to fix. Still won't transition properly
dysbulic πŸ™
dysbulic πŸ™β€’7mo ago
Did you look at the link?
Matt
Mattβ€’7mo ago
Yeah, it seems to be doing it entirely different
dysbulic πŸ™
dysbulic πŸ™β€’7mo 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
Mattβ€’7mo ago
Ohh I was looking at the link I sent completely missed yours Interesting thanks for making that codepen