Is it possible to adjust the position of the .black div below every instance of the .red div if the position of the .red div changes? Any CSS or JS solutions would be greatly appreciated.
HTML
<div class="red">red</div>
<div class="black">black</div>
<div class="red1">red1</div>
<div class="black1">black1</div>
<div class="red2">red2</div>
<div class="black2">black2</div>
<div class="red3">red3</div>
<div class="black3">black3</div>
CSS
div {
position:fixed;
}
.red {
top: 40px;
}
.red1 {
top:80px;
}
.red2 {
top:140px;
}
.red3 {
top:200px;
}