This is what I have so far... it works but text is not selectable on Firefox (works on Safari).
I am very open to discovering a more efficient way of achieving this (if possible) given using background-clip
and -webkit-text-fill-color
is a bit of a hack.
body {
font-family: Arial, Helvetica, sans-serif;
}
a {
position: relative;
color: #fbd6cd;
background-clip: text;
-webkit-background-clip: text;
-moz-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
background-image: linear-gradient(
-45deg,
#fbd6cd,
#fdc0ee
);
}
a:after {
position: absolute;
top: 0px;
left: 0px;
background-clip: text;
-webkit-background-clip: text;
-moz-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
content: "This is a test";
background-image: linear-gradient(
-45deg,
#f7af9e,
#fb8fe1
);
opacity: 0;
transition: opacity 0.3s;
}
a:hover:after {
opacity: 1;
}
<!DOCTYPE html>
<html lang="en">
<body>
<h1><a>This is a test</a></h1>
</body>
</html>