I'm trying to make a dropdown fade animation with 2s delay when hovering on an element, but adding animation-delay doesn't make things work, here is the html and css code:
@keyframes fade {
from {
opacity: 0;
visibility: hidden;
transform: translateY(10px);
}
to {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
}
.dropdown {
position: absolute;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
top: 40px;
background-color: #f9f9f9;
min-width: 330px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
padding: 12px 16px;
z-index: 1;
animation: fade 1s ease forwards;
animation-delay: 2s;
}
.dropdown:hover .dropdown-content {
display: block;
margin-top: 0;
}
<div class="dropdown">
<a href="www.google.com">
some text
</a>
<div class="dropdown-content">
<p style="color: rgb(120, 120, 120);">
more text
</p>
</div>
</div>
The fiddle is here: http://jsfiddle.net/ncr9xLbd/11/
After adding animation-delay, the original fade animation is not working anymore either. I'm new to CSS and couldn't figure out why this doesn't work, any help would be appreciated:)