JSFiddle - React, Tailwind, and code Playground
by Dmitry Nazarov
HTML
<a class="btnfos btnfos-2">Hover</a>
CSS
.btnfos {
color: #19b9c8;
cursor: pointer;
display: block;
font-size: 16px;
font-weight: 400;
line-height: 45px;
max-width: 160px;
margin: 0 auto 2em;
position: relative;
text-transform: uppercase;
vertical-align: middle;
width: 100%;
text-align: center;
}
@media (min-width: 400px) {
.btnfos {
display: inline-block;
margin-right: 2.5em;
}
.btnfos:nth-of-type(even) {
margin-right: 0;
}
}
@media (min-width: 600px) {
.btnfos:nth-of-type(even) {
margin-right: 2.5em;
}
.btnfos:nth-of-type(5) {
margin-right: 0;
}
}
.btnfos-2 {
letter-spacing: 2px;
}
.btnfos-2:hover,
.btnfos-2:active {
letter-spacing: 4px;
}
.btnfos-2:after,
.btnfos-2:before {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
border: 1px solid rgba(255, 255, 255, 0);
bottom: 0px;
content: " ";
display: block;
margin: 0 auto;
position: relative;
-webkit-transition: all 280ms ease-in-out;
transition: all 280ms ease-in-out;
width: 0;
}
.btnfos-2:hover:after,
.btnfos-2:hover:before {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
border-color: #19b9c8;
-webkit-transition: width 350ms ease-in-out;
transition: width 350ms ease-in-out;
width: 70%;
}
.btnfos-2:hover:before {
bottom: auto;
top: 0;
width: 70%;
}