JSFiddle - React, Tailwind, and code Playground
HTML
<ul class="moving-line">
<li>tab 1</li>
<li>tab 2</li>
<li>tab 3</li>
<li>tab 4</li>
<li>tab 5</li>
</ul>
CSS
.moving-line{
display: table;
width: 80%;
margin: 0 auto;
}
.moving-line li{
list-style: none;
display: inline-block;
width: 20%;
float: none;
position: relative;
text-align: center;
padding: 10px 0;
cursor: pointer;
transition: all .2s linear;
}
.moving-line li::before{
content: '';
position: absolute;
top: 0;
left: 100%;
width: 0;
height: 100%;
border-bottom: 2px solid #000;
transition: all .2s linear;
}
.moving-line li:hover::before{
left: 0;
width: 100%;
transition-delay: .2s;
}
.moving-line li:hover ~ li::before{
left: 0;
}