<div class="aaa"></div>
<div class="aaa"></div>
<div class="aaa"></div>
<div class="aaa"></div>
<div class="aaa"></div>
<div class="aaa"></div>
<div class="aaa"></div>
<div class="aaa"></div>
<div class="aaa"></div>
<div class="aaa"></div>
.aaa{
  height: 200px;
  border:1px solid #ccc;
  position: relative;

}
.aaa::before{
  content:'';
  width: 100px;
  height: 100px;
  position: absolute;
  top:0;
  left:0;
  z-index: 1;
  background-color: #501010;

}
.aaa:nth-of-type(2n+1)::before{
  background-color: #bbf142;
}
.aaa:nth-of-type(3n+1)::before{
  background-color: #bf7979;
}
.aaa:nth-of-type(4n+1)::before{
  background-color: #b3165f;
}
.aaa:nth-of-type(5n+1)::before{
  background-color: #103289;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.