CSS de :hover PS öğesi ile bir elemanın üstüne gelindiğinde stil verilebiliyor. Bunun tersini CSS ile nasıl sorgularım?
Şöyle düşünün ::after ile border-bottom ekledim ve bu yalnızca hover olunduğunda görülebiliyor. Hover olma durumuna ekstra animasyon ekledim.
Fakat Hover durumundan çıkınca bir animasyon yok. Transition ile denedim olmadı. Yardımcı olabilecek var mı?
<div class="col-2 header-menu">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Projects</a></li>
<li><a href="#">References</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact Me</a></li>
</ul>
</div>.header-menu ul {
display: flex;
align-items: center;
margin: 0;
}
.header-menu ul li {
list-style: none;
margin-left: 40px;
}
.header-menu ul li a {
text-decoration: none;
color: black;
font-weight: 500;
transition: all .5s;
}
.header-menu ul li a::after {
content: "";
display: block;
border-bottom: 5px solid #7F00FF;
width: 0%;
}
.header-menu ul li a:hover::after {
width: 100%;
animation: header-menu-border .5s ease forwards;
}
.header-menu ul li:last-child {
padding: 10px 15px;
background: linear-gradient(135deg, #7F00FF, #E100FF);
border-radius: 7.5px;
}
.header-menu ul li:last-child a {
color: #fff;
font-weight: 500;
}