<div class="container">
  <ol data-name="counter()">
    <li class="list-item">Ordered list item</li>
    <li class="list-item">
      Ordered list item
      <ol>
        <li class="list-item">
          Ordered list item
          <ol>
            <li class="list-item">Ordered list item</li>
            <li class="list-item">Ordered list item</li>
            <li class="list-item">Ordered list item</li>
          </ol>
        </li>
        <li class="list-item">Ordered list item</li>
        <li class="list-item">Ordered list item</li>
      </ol>
    </li>
    <li class="list-item">Ordered list item</li>
  </ol>

  <ol data-name="counters()">
    <li class="list-item">Ordered list item</li>
    <li class="list-item">
      Ordered list item
      <ol>
        <li class="list-item">
          Ordered list item
          <ol>
            <li class="list-item">Ordered list item</li>
            <li class="list-item">Ordered list item</li>
            <li class="list-item">Ordered list item</li>
          </ol>
        </li>
        <li class="list-item">Ordered list item</li>
        <li class="list-item">Ordered list item</li>
      </ol>
    </li>
    <li class="list-item">Ordered list item</li>
  </ol>
</div>

<div class="form">
  <label for="counter-increment">counter-increment:</label>
  <input type="range" min="-5" max="5" step="1" value="1" id="counter-increment" name="counter-increment">
  <output id="counter-increment-output">1</output>
</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  box-sizing: border-box;
}

body {
  inline-size: 100vw;
  min-block-size: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: "Exo", Arial, sans-serif;
  background-color: #f7f7f7;
  line-height: 2;
  padding: 20px;
}

.container {
  padding: 10px 20px;
  background: #fff;
  box-sizing: border-box;
  box-shadow: 0 2px 4px rgb(0 0 0 / 20%);
  min-width: 50vw;
  border-radius: 5px;
  position: relative;
  width: 80%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  place-content: center;
  place-items: center;
}

.form {
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container > ol {
  position: relative;
}

.container > ol::before {
  content: attr(data-name);
  font-weight: 900;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  color: #090f89;
  text-shadow: 1px 1px 0 rgb(0 0 0 / 0.5);
}

ol {
  counter-reset: countername;
}

li {
  counter-increment: countername var(--counter-increment, 1);
}

li::marker {
  color: #09f;
}

ol:nth-child(1) li::marker {
  content: counter(countername) ": ";
}

ol:nth-child(2) li::marker {
  content: counters(countername, ".") ": ";
}

li li::marker {
  color: #f36;
}

li li li::marker {
  color: #90f;
}
const rootElement = document.documentElement;
const inputRange = document.getElementById("counter-increment");
const rangeOutput = document.getElementById("counter-increment-output");

inputRange.addEventListener("change", (etv) => {
  rootElement.style.setProperty("--counter-increment", etv.target.value);
  rangeOutput.textContent = etv.target.value;
});
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.