<a href="#" class="btn-flip" data-back="Back" data-front="Front"></a>
body{
width: 100vw;
height: 100vh;
display: flex;
position: relative;
background: #1e1e24;
align-items: center;
justify-content: center;
}
$speed: 0.5s;
.btn-flip{
opacity: 1;
outline: 0;
color: #fff;
line-height: 40px;
position: relative;
text-align: center;
letter-spacing: 1px;
display: inline-block;
text-decoration: none;
font-family: 'Open Sans';
text-transform: uppercase;
&:hover{
&:after{
opacity: 1;
transform: translateY(0) rotateX(0);
}
&:before{
opacity: 0;
transform: translateY(50%) rotateX(90deg);
}
}
&:after{
top: 0;
left: 0;
opacity: 0;
width: 100%;
color: #323237;
display: block;
transition: $speed;
position: absolute;
background: #adadaf;
content: attr(data-back);
transform: translateY(-50%) rotateX(90deg);
}
&:before{
top: 0;
left: 0;
opacity: 1;
color: #adadaf;
display: block;
padding: 0 30px;
line-height: 40px;
transition: $speed;
position: relative;
background: #323237;
content: attr(data-front);
transform: translateY(0) rotateX(0);
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.