I have weird issue when I add overflow:hidden to h3 element.
I am trying to hover h3 element and see green low line add from right and it work but if I use overflow on h3 element it invisible for no reason (just delete the comment)
How can I fix it?
.center {
width: 50%;
height: 70%;
margin: 10% auto;
display: flex;
flex-direction: column;
align-items: center;
}
.center>h3 {
padding: 15px 20px 2px 20px;
position: relative;
z-index: 1;
border-bottom: 3px solid rgb(80, 90, 81);
box-sizing: content-box;
/* overflow: hidden; */
}
.center>h3::before {
content: "";
box-sizing: content-box;
position: absolute;
top: 0;
left: 0;
border-bottom: 3px solid rgb(52, 219, 68);
height: 100%;
width: 100%;
z-index: -1;
transform: translateX(100%);
transition-duration: .9s;
}
.center>h3:hover:before {
transform: translateX(0);
}
<div class="center">
<h3>hi hi hi</h3>
<h3>hi hi hi</h3>
<h3>hi hi hi</h3>
<h3>hi hi hi</h3>
</div>