<div id="container">
  <div class="flex__container">
    <div class="flex__item" style="--order: 0"></div>
    <div class="flex__item" style="--order: 0"></div>
    <div class="flex__item" style="--order: 0"></div>
    <div class="flex__item" style="--order: 0"></div>
  </div>

  <div class="flex__container">
    <div class="flex__item" style="--order: 4"></div>
    <div class="flex__item" style="--order: 3"></div>
    <div class="flex__item" style="--order: 2"></div>
    <div class="flex__item" style="--order: 1"></div>
  </div>

  <div class="flex__container">
    <div class="flex__item" style="--order: -1"></div>
    <div class="flex__item" style="--order: -2"></div>
    <div class="flex__item" style="--order: -3"></div>
    <div class="flex__item" style="--order: -4"></div>
  </div>
</div>
@import url("https://fonts.googleapis.com/css?family=Gochi+Hand");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  background-color: #291642;
  font-family: "Gochi Hand", sans-serif;
  font-size: 100%;
  letter-spacing: 0.1rem;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
}

:root {
  --writingMode: horizontal-tb;
  --direction: ltr;
  --flexDirection: row;
  --flexWrap: nowrap;
  --justifyContent: center;
  --alignItems: center;
  --order: 0;
}

#container {
  writing-mode: var(--writingMode);
  direction: var(--direction);

  display: flex;
  justify-content: center;
  align-items: center;
}

.flex__container {
  display: flex;
  flex-direction: var(--flexDirection);
  flex-wrap: var(--flexWrap);
  justify-content: var(--justifyContent);
  align-items: var(--alignItems);

  inline-size: 80vh;
  block-size: 28vh;
  border: 1px dashed #e91e63;
  border-color: #ffeb3b #ff5722 #fff #00bcd4;
  position: relative;
  counter-reset: listCounter;

  margin: 2vh;
  padding: 2vh 2vh 6vh;
}

.flex__item {
  display: flex;
  justify-content: center;
  align-items: center;
  inline-size: 18vh;
  block-size: 18vh;
  counter-increment: listCounter;
  order: var(--order);
  position: relative;
  margin: 2vh 1vh;
}

.flex__item::before {
  content: "[" counter(listCounter) "]";
  font-size: 1.5rem;
  background: rgba(0, 0, 0, 0.65);
  padding: 4px;
  border-radius: 4px;
}

.flex__item:nth-child(1) {
  background-color: #f36;
}

.flex__item:nth-child(2) {
  background-color: #cddc39;
}

.flex__item:nth-child(3) {
  background-color: #2196f3;
}

.flex__item:nth-child(4) {
  background-color: #ff5722;
}

.flex__item:nth-child(5) {
  background-color: #f22;
}

.flex__item:nth-child(6) {
  background-color: #722;
}

.flex__item:nth-child(7) {
  background-color: #ff5;
}

.flex__item:nth-child(8) {
  background-color: #9f9f9f;
}

.flex__item::after {
  content: attr(style);
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translate(-50%, 0);
  white-space: nowrap;
  font-size: 80%;
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.