I'm trying to create a CSS animation using the transform property. Specifically, I want to have an underline animation when a link is hovered over. Strangely, the code that works in another HTML file is not working here. Although the links change color to white when hovered over, the transformation is not being displayed. Below is the HTML for the navigation bar and the relevant CSS:
ul {
list-style-type: none;
}
li {
display: inline;
}
li a {
color: black;
text-decoration: none;
}
.link:hover {
color: white;
}
.link:before {
content: "";
visibility: hidden;
transform: scaleX(0);
transition: all 0.3s ease-in-out 0s;
background-color: #000;
}
.link:hover:before {
visibility: visible;
transform: scaleX(1);
}
<nav>
<ul>
<li><a class="link" href="home.html">Home</a></li> -
<li><a class="link" href="code.html">Code</a></li> -
<li><a class="link" href="webpages.html">Webpages</a></li> -
<li><a class="link" href="articles.html">Articles</a></li> -
<li><a class="link" href="resume.html">Resume</a></li>
</ul>
</nav>