I have the following HMTL
and CSS
:
.parent{
height: 10%;
width: 100%;
float: left;
}
.content1{
height: 100%;
width: 20%;
background-color: blue;
float: left;
}
.content2{
height: 100%;
width: 20%;
background-color: red;
float: left;
}
.content3{
height: 100%;
width: 20%;
background-color:yellow;
float: left;
}
.content4{
height: 100%;
width: 20%;
background-color: green;
float: left;
}
.content5{
height: 100%;
width: 20%;
background-color: orange;
float: left;
}
.parent {
animation-name: animation_01;
animation-duration:5s;
animation-iteration-count:1;
animation-fill-mode: forwards;
}
@keyframes animation_01 {
0% {
opacity: 0
}
20% {
opacity: 1
}
40% {
opacity: 0
}
60% {
opacity: 1
}
80% {
opacity: 0
}
100% {
opacity: 1
}
}
}
<div class="parent">
<div class="content1">Here goes content1</div>
<div class="content2">Here goes content2</div>
<div class="content3">Here goes content3</div>
<div class="content4">Here goes content4</div>
<div class="content5">Here goes content5</div>
</div>
This code itself works fine.
You can also find it in the JSfiddle here.
My target now is to display content1
to content5
one after another. Therefore, I wanted to use the opacity
function within the animation
of the CSS. However, I could not yet figure out how I can use opacity
for an individual content because right now the animation only runs for all five contents combined.
Do you know if its is possible to get this animation working within @keyframes
or do I need javascript/jQuery like in the example here?