<h3 class="hover-3">Hover Me</h3>
.hover-3 {
--c: #1095c1; /* the color */
--h: 1.2em; /* the height */
line-height: var(--h);
color: #0000;
overflow: hidden;
text-shadow:
0 calc(-1*var(--h)*var(--_i,0)) var(--c),
0 calc(var(--h)*(1 - var(--_i,0))) #fff;
background:
linear-gradient(var(--c) 0 0) no-repeat
calc(200% - var(--_i, 0) * 100%) 100% / 200% calc(100% * var(--_i, 0) + .08em);
transition: .3s calc(var(--_i, 0) * .3s), background-position .3s calc(.3s - calc(var(--_i, 0) * .3s));
}
.hover-3:hover {
--_i: 1;
}
body {
height: 100vh;
margin: 0;
display: grid;
place-content: center;
}
h3 {
font-family: system-ui, sans-serif;
font-size: 3rem;
margin:0;
cursor: pointer;
padding: 0 .1em;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.