I want make an underline animation on a link
this is my html
<header>
<div class="title">
<p>feldman</p>
</div>
<nav>
<a href="intro.html">Intro</a>
<a href="about.html">About</a>
<a href="fieldman.html">Services</a>
<a href="project.html">Project</a>
<a href="contact.html">Contact</a>
</nav>
</header>
my css:
a::after{
content: "";
position: absolute;
width: 0%;
height: 1px;
display: block;
background-color: black;
transition: width 0.2s ease-in-out;
}
a:hover:after{
width: 100%;
}
the problem is when I put the cursor on the link all the link is underlined
I want a solution to fix the problem the underline should be only on one link
ok now my css:
nav a{
color: black;
text-decoration: none;
margin: 6px;
width: calc(100%/5);
padding: 3px 4px 3px 5px ;
line-height:1;
position: relative;
display: inline-block;
}
nav{
margin-top: 9px;
margin-right: 18px;
width: 40%;
height: 75%;
display: flex;
justify-content: center;
margin: auto 10px;
}
header{
display: flex;
justify-content: flex-end;
}