JSFiddle - React, Tailwind, and code Playground
by mzilverberg
HTML
<a href="javascript:;" class="btn" data-label="Hover over me!">Hover over me!</a>
SCSS
* {
&,
&:before,
&:after {
box-sizing: border-box;
}
}
html {
font: 16px/1.4 Arial, sans-serif;
color: #000;
}
.btn {
&,
&:after {
position: relative;
display: inline-block;
background: #368;
padding: 1em 2.5em;
border-radius: 3px;
color: #fff;
text-decoration: none;
transition-property: all;
transition-duration: 1.5s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
}
&:after {
position: absolute;
left: 0;
top: 0;
bottom: 0;
background: #fff;
color: #368;
content: attr(data-label);
height: 0;
//opacity: 0;
}
&:hover:after {
height: 100%;
//opacity: 1;
}
}