<a>
<span class="gradient-text">👉 Click me 👈</span>
</a>
<link href="https://fonts.googleapis.com/css?family=Archivo+Black&display=swap" rel="stylesheet">
/* Tutorial on https://fossheim.io/writing/posts/css-text-gradient. */
.gradient-text {
/* Fallback: Set a background color. */
background-color: #6c36d8;
/* Create the gradient. */
background-image: linear-gradient(
45deg,
#0a4234 50%,
#f2cfed 50%
);
/* Set the background size and repeat properties. */
background-size: 270%;
background-repeat: repeat;
background-position: top right;
/* Use the text as a mask for the background. */
/* This will show the gradient as a text color rather than element bg. */
background-clip: text;
text-fill-color: transparent;
background-clip: text;
text-fill-color: transparent;
animation: button-animation 0.65s 0.15s ease-out forwards;
}
a:hover, a:hover span{
animation: button-animation-rev 0.65s ease-out forwards;
}
a:hover {
box-shadow: 3px 2px 10px 1px rgba(0,0,0,0.15);
transition: 0.5s;
}
@keyframes button-animation {
0% {
background-position: top right;
}
100% {
background-position: top left;
}
}
@keyframes button-animation-rev {
0% {
background-position: top left;
}
100% {
background-position: top right;
}
}
/* Style the rest of the page. */
body {
background-color: #fcfdfc;
}
a {
margin-top: 1em;
margin-top: calc(50vh - 3em);
margin-left: auto;
margin-right: auto;
background-image: linear-gradient(45deg, #f2cfed 50%, #0a4234 50%);
background-size: 270%;
background-repeat: repeat;
background-position: top right;
animation: button-animation 0.65s 0.15s ease-out forwards;
display: table;
border-radius: 0.5em;
text-decoration: none;
box-shadow: 7px 4px 20px 1px rgba(0,0,0,0.15);
padding: 1.5em 0;
cursor: pointer;
}
a span {
font-family: "Archivo Black", sans-serif;
font-weight: normal;
font-size: 2em;
text-align: center;
margin-bottom: 0;
margin-bottom: -0.25em;
width: 100%;
padding: 0 1.5em;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.