@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

body {
  width: 100vw;
  min-height: 100vh;
  counter-reset: section;
  font-family: "Exo", Arial, sans-serif;
  font-size: 20px;
  font-weight: 600;
  padding: 10px;
  box-sizing: border-box;
}

.item {
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  height: 10em;
  position: relative;
}

.item::before {
  counter-increment: section;
  content: counter(section);
  background-image: radial-gradient(
      50% 105%,
      #fffff5 15%,
      #fff3d5 31%,
      #ffd484 100%
    ),
    radial-gradient(51% 200%, #fffcf5 100%, rgba(251, 213, 142, 0) 100%),
    radial-gradient(50% 103%, #ff5f49 15%, #ff1919 100%);
  background-origin: border-box;
  background-clip: padding-box, padding-box, border-box;
  border: 2px solid transparent;
  box-shadow: 0 2px 10px 0 rgba(96, 43, 43, 0.5);
  border-radius: 50%;
  padding: 10px;
  font-size: 2em;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  right: 10px;
  bottom: 10px;
  color: #fff;
  text-shadow: 1px 0px 0 rgb(103 105 171), 0px 1px 0 rgb(221 17 17),
    -1px 0px 0 rgb(113 12 206), 0px -1px 0 rgb(207 107 225),
    2px 0px 0 rgb(103 105 171), 0px 2px 0 rgb(221 17 17),
    -2px 0px 0 rgb(113 12 206), 0px -2px 0 rgb(207 107 225);
  width: 48px;
  height: 48px;
  mix-blend-mode: difference;
  filter: hue-rotate(180deg);
  backdrop-filter: saturate(0.8);
}

.item:nth-child(2n) {
  height: 14em;
}
.item:nth-child(3n) {
  height: 18em;
}
.item:nth-child(4n) {
  height: 22em;
}
.item:nth-child(5n) {
  height: 24em;
}
.item:nth-child(6n) {
  height: 30em;
}
.item:nth-child(7n) {
  height: 34em;
}

.item:nth-child(8n) {
  height: 40em;
}

body {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: masonry;
  gap: 10px;
}
for (let i = 0; i <= 50; i++) {
  const div = document.createElement("div");
  div.classList.add("item");
  div.style.backgroundImage = `url(https://picsum.photos/500/500?random=${i})`;
  document.body.appendChild(div);
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.