<div id="container">
  <div class="flex__container" data-justify-content="flex-start">
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
  </div>
</div>

<div id="container">
  <div class="flex__container" data-justify-content="flex-end">
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
  </div>
</div>

<div id="container">
  <div class="flex__container" data-justify-content="start">
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
  </div>
</div>

<div id="container">
  <div class="flex__container" data-justify-content="end">
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
  </div>
</div>

<div id="container">
  <div class="flex__container" data-justify-content="left">
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
  </div>
</div>

<div id="container">
  <div class="flex__container" data-justify-content="right">
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></div>
    <div class="flex__item"></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;
  padding: 10vh;
  background-color: #291642;
  font-family: "Gochi Hand", sans-serif;
  font-size: 130%;
  letter-spacing: 0.1rem;
  color: #fff;
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
  align-items: center;
}

:root {
  --justifyContent: flex-start;
}

.flex__container {
  display: flex;
  justify-content: var(--justifyContent);

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

.flex__item {
  display: flex;
  justify-content: center;
  align-items: center;
  inline-size: 10vh;
  block-size: 10vh;
  counter-increment: listCounter;
}

.flex__item::before {
  content: "[" counter(listCounter) "]";
  font-size: 2rem;
  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__container::after {
  content: attr(data-justify-content);
  position: absolute;
  top: calc(100% + 2vh);
  left: 50%;
  transform: translate(-50%, 0);
}

.flex__container[data-justify-content="flex-start"] {
  --justifyContent: flex-start;
}

.flex__container[data-justify-content="flex-end"] {
  --justifyContent: flex-end;
}

.flex__container[data-justify-content="start"] {
  --justifyContent: start;
}

.flex__container[data-justify-content="end"] {
  --justifyContent: end;
}

.flex__container[data-justify-content="left"] {
  --justifyContent: left;
}

.flex__container[data-justify-content="right"] {
  --justifyContent: end;
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.