<h3 class="hover-4">Hover Me</h3>
.hover-4 {
--h: 1.2em; /* the height */
--c: #1095c1; /* the color */
line-height: var(--h);
color: #0000;
text-shadow:
0 var(--_t,var(--h)) #fff,
0 0 var(--_c,#000);
clip-path: inset(0 0 1px 0);
background: linear-gradient(var(--c) 0 0) 0 var(--_t,var(--h)) no-repeat;
transition: 0.4s ,clip-path 0.4s 0.4s;
}
.hover-4:hover {
--_t: 0;
--_c: #0000;
clip-path: inset(0 0 calc(-1*var(--h)) 0);
transition: 0.4s 0.4s, clip-path 0.4s;
}
body {
height: 100vh;
margin: 0;
display: grid;
place-content: center;
background: pink;
}
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.