JSFiddle - React, Tailwind, and code Playground
HTML
<a href='#'>Test</a>
CSS
body {
color:#ffffff;
font-family:"Helvetica";
font-size:12pt;
background-color:#000000;
font-weight:bold;
}
a:link {
color:white;
text-decoration:none;
}
a.hover {
-webkit-animation-name: myhover;
-webkit-animation-duration: 1s;
-webkit-animation-fill-mode: forwards;
transition-timing-function: ease-in-out;
font-weight: bold;
}
@-webkit-keyframes myhover {
from {
background-color: black;
color: white;
}
to {
background-color: white;
color: black;
}
}
a.hoverout {
-webkit-animation-name: hoverout;
-webkit-animation-duration: 1s;
-webkit-animation-fill-mode: reverse;
transition-timing-function: ease-in-out;
font-weight: bold;
}
@-webkit-keyframes hoverout {
from {
background-color: white;
color: black;
}
to {
background-color: black;
color: initial;
}
}
JavaScript
$(document).ready(function() {
$( "a" ).hover( function() {
$( this ).removeClass('hoverout').addClass( "hover" );
}, function() {
$( this ).removeClass( "hover" ).addClass("hoverout");
});
});