<section class='spots-section clearfix' data-bind='foreach: spots'>
  <div class='spot' data-bind="css: type"></div>
</section>
@import "lesshat";

@extra-small: ~" (min-width: 480px)";
@small: ~" (min-width: 768px)";
@medium: ~" (min-width: 992px)";
@large: ~" (min-width: 1200px)";
@light: #eee;
@size: 100px;
.background-linear(@from, @to) {
  background-color: @from;
  background: -webkit-linear-gradient(@from, @to);
  background: -o-linear-gradient(@from, @to);
  background: -moz-linear-gradient(@from, @to);
  background: linear-gradient(@from, @to);
}
* {
  box-sizing: border-box;
  margin: 0;
}
body {
  background-color: #333;
}
.spots-section {
  margin: 0 auto;
  padding: 4px;
  position: relative;
}
.spot {
  text-align: center;
  background-color: slategray;
  float: left;
  margin: 4px;
  width: @size;
  height: @size;
  border-radius: 50%;
  font-weight: bold;
  line-height: @size;
  @media @extra-small {
    width: @size + 20%;
    height: @size + 20%;
    line-height: @size + 20%;
  }
  @media @small {
    width: @size + 50%;
    height: @size + 50%;
    line-height: @size + 50%;
  }
  @media @medium {
    width: @size + 70%;
    height: @size + 70%;
    line-height: @size + 70%;
  }
  @media @large {
    width: @size + 100%;
    height: @size + 100%;
    line-height: @size + 100%;
  }
}
.banana {    
  .background-linear(yellow, @light);
  color: black;
  &:before {
    content: 'banana';
  }
}
.orange {
  .background-linear(orange, @light);
  color: black;
  &:before {
    content: 'orange';
  }
}
.apple {
  .background-linear(green, @light);
  color: white;
  &:before {
    content: 'apple';
  }
}
.tomato {
  .background-linear(tomato, @light);
  color: white;
  &:before {
    content: 'tomato';
  }
}
.silver {
  .background-linear(slategray, @light);
  color: white;
  &:before {
    content: 'silver';
  }
}
.clearfix {
  overflow: auto;
}
var app =
    (function () {
        var spots = ko.observableArray([
            { type: ko.observable('apple') },
            { type: ko.observable('orange') },
            { type: ko.observable('banana') },
            { type: ko.observable('tomato') },
            { type: ko.observable('silver') },
            { type: ko.observable('apple') },
            { type: ko.observable('orange') },
            { type: ko.observable('banana') },
            { type: ko.observable('tomato') },
            { type: ko.observable('silver') },
            { type: ko.observable('apple') },
            { type: ko.observable('orange') },
            { type: ko.observable('banana') },
            { type: ko.observable('tomato') },
            { type: ko.observable('silver') },
            { type: ko.observable('apple') },
            { type: ko.observable('orange') },
            { type: ko.observable('banana') },
            { type: ko.observable('tomato') },
            { type: ko.observable('silver') }
        ]);
        var data = {
            spots: spots
        };
        ko.applyBindings(data);
        return data;
    })();

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js