I am trying to make an underline animation that comes from the middle and extends to the sides
I copied the code from an example i found online which was working but not on my case
I have added the code on jsfiddle below
you are looking in the beginning of the css for .htext:after
and .htext:after:hover
https://jsfiddle.net/wvm2sfp0/1/
body {
background: rgb(14, 13, 13);
color: white;
width: 100%;
}
header {
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
background: linear-gradient(to top, rgba(0, 0, 0, 0), rgb(0, 0, 0, 0.8));
}
a {
text-decoration: none;
color: inherit;
}
p {
color: white;
}
.div1 {
background-image: url(../images/Group\ 10.png);
}
.htext {
margin-right: 3%;
font-size: 0.75vw;
transition: text-decoration 0.3s;
}
.htext:after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 0;
left: 0;
background-color: #54B3A1;
transform-origin: center;
transition: transform 0.25s ease-out;
margin-bottom: -20px;
}
.htext:after:hover {
transform: scaleX(1);
transform-origin: center;
}
.logo1 {
margin-right: 10%;
height: 7%;
width: 8%;
}
.logo2 {
margin-right: 1.5%;
}
<div class="div1">
<header>
<img src="images/viennalogo.png" class="logo1">
<a href="#" class="htext">
<p>HOME</p>
</a>
<a href="#" class="htext">
<p>BRANDS WE WORK WITH</p>
</a>
<a href="#" class="htext">
<p>BRAND GALLERY</p>
</a>
<a href="#" class="htext">
<p>NEWS</p>
</a>
<a href="#" class="htext">
<p>ABOUT US</p>
</a>
<a href="#" class="htext">
<p>CONTACT</p>
</a>
<a href="#" class="logo2"><img src="images/Facebook.png"></a>
<a href="#" class="logo2"><img src="images/Instagram.png"></a>
<a href="#" class="logo2"><img src="images/Twitter.png"></a>
</header>
</div>