I'm experimenting with CSS animations, and I can not find a way for two animations to occur at the same time. I tried several ways, for example writing the two HTML tags on the same line, or that the two elements have the same animation, and the latter works, but I need the animations to be different, this is what I try:
.item-lista {
position: absolute;
text-align: center;
top: 12px;
font-size: 20px;
list-style: none;
animation-duration: 1s;
animation-name: item-fall;
}
@keyframes item-fall {
from {
margin-top: -800%;
}
to {
margin-top: 0%;
}
}
.link {
text-decoration: none;
color: black;
}
.link-p {
text-decoration: none;
color: rgba(240, 129, 56, 1);
}
.link:hover {
text-shadow: 1.5px 1.5px rgba(240, 129, 56, 0.8);
}
#item-3 {
position: absolute;
right: 10px;
}
#item-2 {
position: absolute;
right: 100px;
}
#item-1 {
position: absolute;
right: 170px;
}
#a-logo {
text-decoration: none;
color: inherit;
}
#logo {
position: absolute;
top: 4px;
left: 12px;
color: rgba(240, 129, 56, 1);;
font-size: 35px;
font-family: fantasy;
cursor: pointer;
animation-duration: 1s;
animation-name: slidein;
}
@keyframes slidein {
from {
margin-left: 80%;
width: 280%
}
to {
margin-left: 0%;
width: 100%;
}
}
#logo::after {
content: " Probando animaciones";
font-size: 0px;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
#logo:hover::after {
font-size: 28px;
}
<nav>
<div id="logo"><a href="#1" id="a-logo"><strong>FM</strong></a></div>
<div id="logo-close"></div>
<ul>
<li class="item-lista" id="item-1"><a href="#1" class="link-p">Inicio</a></li>
<li class="item-lista" id="item-2"><a href="#2" class="link">About</a></li>
<li class="item-lista" id="item-3"><a href="#3" class="link">Contacto</a></li>
</ul>
</nav>
I need the slidein and item-fall animations to run at the same time. Thank you very much