<a href="#" data-link-alt="Do you like this?"><span>Mmm touch me...</span></a>
@import url(https://fonts.googleapis.com/css?family=Roboto+Slab:400,300);
// root html style
:root {
width: 100%;
height: 100%;
transition: font-size 500ms cubic-bezier(0.680, -0.550, 0.265, 1.550);
font-size: 100%;
@media screen and (min-width: 50em) {
font-size: 150%; }
@media screen and (min-width: 80em) {
font-size: 180%; }
}
// body style
body {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: #00BCD4;
line-height: 1.5;
animation: rainbow 25s infinite;
user-select: none;
font-family: "Roboto Slab", serif; }
// link element
a {
color: #FFFFFF;
position: relative;
text-decoration: none;
margin: 2rem;
font-size: 3rem;
flex-grow: 1;
font-weight: 300;
overflow: hidden;
display: block;
text-align: center;
animation-duration: 1s;
animation-fill-mode: both;
// text element inside
span {
display: block;
transition: transform 500ms cubic-bezier(0.680, -0.550, 0.265, 1.550); }
// slide text from data-link-title
&:after {
content: attr(data-link-alt);
display: inline;
position: absolute;
transition: top 500ms cubic-bezier(0.680, -0.550, 0.265, 1.550);
top: 100%;
left: 0;
right: 0;
text-align: center; }
// animation when hovered
&:hover {
cursor: grab;
span {
transform: translateY(-100%); }
&:after {
top: 0; }
}
&:active {
animation-name: rubberBand;
cursor: grabbing; }
}
// Background animation
@keyframes rainbow {
0% { background: #00BCD4; }
25% { background: #00C853; }
50% { background: #C62828; }
75% { background: #4527A0; }
100% { background: #00BCD4; }
}
@keyframes rubberBand {
0% {
transform: scale3d(1, 1, 1);
}
30% {
transform: scale3d(1.25, 0.75, 1);
}
40% {
transform: scale3d(0.75, 1.25, 1);
}
50% {
transform: scale3d(1.15, 0.85, 1);
}
65% {
transform: scale3d(.95, 1.05, 1);
}
75% {
transform: scale3d(1.05, .95, 1);
}
100% {
transform: scale3d(1, 1, 1);
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.