JSFiddle - React, Tailwind, and code Playground

by Louis Walch

HTML

<div class="buttons">
    <a href="faasdfasd" data-hover="This is a test"><span>This is a test</span></a>
</div>

CSS

BODY { background-color: #ccc; }

A { text-decoration: none; }

.buttons  {
    position: relative;
    display:block;
    height: 58px;
    display: inline-block;
    overflow: hidden;
    width: auto;
    font-size: 19px;
    text-transform: uppercase;
}
.buttons A {
    border: 2px solid #0cb0e1;
    border-radius: 3px;
    overflow: hidden;
    display: block;
    }

.buttons A SPAN {
    color: #0cb0e1;
    display: block;
    -webkit-transition: -webkit-transform 0.2s;
    -moz-transition: -moz-transform 0.2s;
    -o-transition: -o-transform 0.2s;
    -ms-transition: -ms-transform 0.2s;
    transition: transform 0.2s;
    padding: 0 20px;
    }

.buttons A::before {
    background: #0cb0e1;
    color: #fff;
    position: absolute;
    top: 0;
    left: 0;    
    text-align: center;
    z-index: -1;
    width: 100%;
    height: 100%;
    content: attr(data-hover);
    -webkit-transition: -webkit-transform 0.2s;
    -moz-transition: -moz-transform 0.2s;
    -o-transition: -o-transform 0.2s;
    -ms-transition: -ms-transform 0.2s;
    transition: transform 0.2s;
    -webkit-transform: translateX(-100%);
    -moz-transform: translateX(-100%);
    -ms-transform: translateX(-100%);
    -o-transform: translateX(-100%);
    transform: translateX(-100%);
    padding: 2px 0;
    }
    .buttons A:hover span,
    .buttons A:focus span {
    -webkit-transform: translateX(100%);
    -moz-transform: translateX(100%);
    -ms-transform: translateX(100%);
    -o-transform: translateX(100%);
    transform: translateX(100%);
    }
    .buttons A:hover::before,
    .buttons A:focus::before {
    -webkit-transform: translateX(0%);
    -moz-transform: translateX(0%);
    -ms-transform: translateX(0%);
    -o-transform: translateX(0%);
    transform: translateX(0%);
    }