Given a large set of <hr>
html elements which at page load should change color one after another. At the moment the animation works but it requires a large amount of repetitive manual labour in CSS for each consequtive newly added <hr>
element in html. Since the transition intervals is the same for each next <hr>
line, could this be written in a more elegant and shorter way in CSS?
The goal is to be able to add new hr elements without the need to change the CSS every time.
Again: this question is about how to do this (more elegantly) in CSS alone? (without js/sass/scss)
nav hr{
border-top: 3px solid #BBB;
border-bottom: 0px;
margin: 10px 0;
}
nav hr:nth-of-type(01){animation: .5s ease 0.0s 1 gogo}
nav hr:nth-of-type(02){animation: .5s ease 0.1s 1 gogo}
nav hr:nth-of-type(03){animation: .5s ease 0.2s 1 gogo}
nav hr:nth-of-type(04){animation: .5s ease 0.3s 1 gogo}
nav hr:nth-of-type(05){animation: .5s ease 0.4s 1 gogo}
nav hr:nth-of-type(06){animation: .5s ease 0.5s 1 gogo}
nav hr:nth-of-type(07){animation: .5s ease 0.6s 1 gogo}
nav hr:nth-of-type(08){animation: .5s ease 0.7s 1 gogo}
nav hr:nth-of-type(09){animation: .5s ease 0.8s 1 gogo}
nav hr:nth-of-type(10){animation: .5s ease 0.9s 1 gogo}
nav hr:nth-of-type(11){animation: .5s ease 1.0s 1 gogo}
nav hr:nth-of-type(12){animation: .5s ease 1.1s 1 gogo}
/* Boy this takes a lot of time for every new <hr> added in the html */
@keyframes gogo {
0% {border-top-color: #DDD}
100% {border-top-color: #00F}
}
<nav>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
<hr>
</nav>