JSFiddle - React, Tailwind, and code Playground
by DJS Baker
HTML
<ul>
<li>
<a href="" title="ROLLOVER1">ROLLOVER1</a>
</li>
<li>
<a href="" title="ROLLOVER2">ROLLOVER2</a>
</li>
<li>
<a href="" title="ROLLOVER3">ROLLOVER3</a>
</li>
<li>
<a href="" title="ROLLOVER4">ROLLOVER4</a>
</li>
</ul>
CSS
li {
float: left;
list-style: none;
margin: 0 10px;
display: block;
position: relative;
}
a:before {
width: 0;
min-height: 100%;
background: transparent;
opacity: 0;
height: 10px;
display: block;
content: '';
position: absolute;
margin-left: 50%;
opacity: 0.4;
}
a:hover:before {
width: 100%;
margin-left: 0;
background: white;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
a {
color: #000;
display: block;
text-decoration: none;
position: relative;
font-weight: bold;
}
a:hover {
color: blue;
-webkit-transition: color 0.4s ease-in;
-moz-transition: color 0.4s ease-in;
-o-transition: color 0.4s ease-in;
transition: color 0.4s ease-in;
}
a:after {
border-bottom: 1px solid transparent;
display: block;
color: transparent;
content: '';
margin-left: 50%;
width: 0%;
opacity: 0;
-webkit-transition: all 0.4s ease-in;
-moz-transition: all 0.4s ease-in;
-o-transition: all 0.4s ease-in;
transition: all 0.4s ease-in;
display: block;
padding: 2px 0;
}
a:hover:after {
border-bottom: 2px solid blue;
margin-left: 0%;
width: 100%;
opacity: 0.4;
}