<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>
        <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>

  <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>
        <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>
</div>

<div class="form">
  <label for="style">style(counter-style):</label>
  <select name="style" id="style">
    <optgroup label="Numeric">
      <option value="decimal">decimal</option>
      <option value="decimal-leading-zero">decimal-leading-zero</option>
      <option value="arabic-indic">arabic-indic</option>
      <option value="armenian">armenian</option>
      <option value="upper-armenian">upper-armenian</option>
      <option value="lower-armenian">lower-armenian</option>
      <option value="bengali">bengali</option>
      <option value="cambodian">cambodian</option>
      <option value="khmer">khmer</option>
      <option value="cjk-decimal">cjk-decimal</option>
      <option value="devanagari">devanagari</option>
      <option value="georgian">georgian</option>
      <option value="gujarati">gujarati</option>
      <option value="gurmukhi">gurmukhi</option>
      <option value="hebrew">hebrew</option>
      <option value="kannada">kannada</option>
      <option value="lao">lao</option>
      <option value="malayalam">malayalam</option>
      <option value="mongolian">mongolian</option>
      <option value="myanmar">myanmar</option>
      <option value="oriya">oriya</option>
      <option value="persian">persian</option>
      <option value="lower-roman">lower-roman</option>
      <option value="upper-roman">upper-roman</option>
      <option value="tamil">tamil</option>
      <option value="telugu">telugu</option>
      <option value="thai">thai</option>
      <option value="tibetan">tibetan</option>
    </optgroup>
    <optgroup label="Alphabetic">
      <option value="lower-alpha">lower-alpha</option>
      <option value="lower-latin">lower-latin</option>
      <option value="upper-alpha">upper-alpha</option>
      <option value="upper-latin">upper-latin</option>
      <option value="lower-greek">lower-greek</option>
      <option value="hiragana">hiragana</option>
      <option value="hiragana-iroha">hiragana-iroha</option>
      <option value="katakana">katakana</option>
      <option value="katakana-iroha">katakana-iroha</option>
    </optgroup>
    <optgroup label="Fixed">
      <option value="cjk-earthly-branch">cjk-earthly-branch</option>
      <option value="cjk-heavenly-stem">cjk-heavenly-stem</option>
    </optgroup>
  </select>
</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;
  justify-content: center;
  gap: 10px;
  font-family: "Exo", Arial, sans-serif;
  background-color: #f7f7f7;
  line-height: 2;
}

.container {
  padding: 10px 20px;
  background: #fff;
  box-sizing: border-box;
  box-shadow: 0 2px 4px rgb(0 0 0 / 20%);
  border-radius: 5px;
  position: relative;
  width: 80%;
  min-width: 320px;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  place-content: center;
  place-items: start center;
}

.container ol {
  position: relative;
  list-style: none;
}

.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);
}
li::before {
  display: inline-flex;
  color: #fff;
  background-color: #f36;
  padding: 10px;
  line-height: 1;
  font-size: 2rem;
  margin-right: 10px;
  aspect-ratio: 1 / 1;
  justify-content: center;
  align-items: center;
  clip-path: polygon(
    0% 0%,
    89% 0,
    89% 40%,
    100% 50%,
    89% 61%,
    88% 100%,
    0 100%
  );
  border-radius: 50%;
  font-size: 85%;
}

li li::before {
  background-color: #09f;
}

li li li::before {
  background-color: #89f;
}

.form {
  position: fixed;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgb(0 0 0 / 0.8);
  padding: 10px;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

ol {
  counter-reset: order;
}

li {
  counter-increment: order;
}

ol:nth-child(1) li::before {
  content: counter(order, var(--style, decimal));
}

ol:nth-child(2) li::before {
  content: counters(order, "_", var(--style, decimal));
}
const rootEle = document.documentElement;
const select = document.getElementById("style");

select.addEventListener("change", (etv) => {
  rootEle.style.setProperty("--style", 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.