I'm trying to make the divs appear one after another on page load. Problem is this setup only works IF I add a visibility: hidden
property to the div selector, which in turn, reverses the animation. What am I missing?
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
display: flex;
align-items: center;
justify-content: space-around;
height: 100vh;
background-color: rgb(73, 73, 73);
}
div {
width: 15vh;
height: 15vh;
background-color: rgb(53, 53, 53);
}
.box1 {
animation: test 1s;
}
.box2 {
animation: test 1.1s;
}
.box3 {
animation: test 1.2s;
}
.box4 {
animation: test 1.3s;
}
.box5 {
animation: test 1.4s;
}
@keyframes test {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
<div class="box5"></div>