Wie ändert man die Hintergrundfarbe eines Divs im Laufe der Zeit durch alle Farben eines Regenbogens und stellt es dann wieder auf seine ursprüngliche Farbe und Schleife diesen Prozess unendlich?Loop div Hintergrundfarbe durch alle Regenbogenfarben allmählich | CSS
Der Code unten ist das Ergebnis, das ich will, aber in nur einem div, das seine Farbe allmählich ändert.
<div id="rainbow"></div>
.rainbow {
background-color: blue;
float:left;
width: 70px;
height:70px;
border: 1px solid white;
}
.rainbow:first-child {
background-color: red;
}
.rainbow:nth-child(2) {
background-color: orange;
}.rainbow:nth-child(3) {
background-color: yellow;
}.rainbow:nth-child(4) {
background-color: Chartreuse;
}.rainbow:nth-child(5) {
background-color: cyan;
}.rainbow:nth-child(6) {
background-color: blue;
}.rainbow:nth-child(7) {
background-color: DarkOrchid;
}.rainbow:nth-child(8) {
background-color: DeepPink;
}.rainbow:nth-child(9) {
background-color: red;
}
.rainbow:last-child {
background-color: Chartreuse;
float:left;
border: 1px solid white;
clear:both;
}
<div class="rainbow">Original color</div>
<div class="rainbow">After some time</div>
<div class="rainbow">After some time</div>
<div class="rainbow">After some time</div>
<div class="rainbow">After some time</div>
<div class="rainbow">After some time</div><div class="rainbow">After some time</div><div class="rainbow">After some time</div><div class="rainbow">Come back to red and loop</div>
<br style="clear:both">
All of the above in just one div
Vielen Dank! Das habe ich gesucht! – TSR
Gern geschehen. –