<h3 class="hover">Hover Me</h3>
.hover {
--c: #1095c1; /* the color */
color: #0000;
background:
linear-gradient(90deg,#fff 50%,var(--c) 0) calc(100% - var(--_p,0%))/200%,
linear-gradient(var(--c) 0 0) 0% 100%/var(--_p,0%) no-repeat,
var(--_c,#0000);
-webkit-background-clip: text,padding-box,padding-box;
background-clip: text,padding-box,padding-box;
transition: 0s ,color .5s,background-color .5s;
}
.hover:hover {
color: #fff;
--_c: var(--c);
--_p: 100%;
transition: 0.5s,color 0s .5s,background-color 0s .5s;
}
body {
height: 100vh;
margin: 0;
display: grid;
grid-template-columns: auto auto;
gap: 20px;
place-content: center;
align-items: 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.