<div class="container">
  <div class="color-1"></div>
  <div class="color-2"></div>
  <div class="color-3"></div>
  <div class="color-4"></div>
</div>
.container {
  width: 100%;
  height: 100vh;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

@for $i from 1 through 4 { 
  .color-#{$i} {
    background-color: hsl(floor(random(360)), 100, 60);
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.