<div class="container">
  <div class="counter-reset">
    <h1 data-element="h1">Counter-reset</h1>
    <p data-element="p">The counter-reset CSS property resets a CSS counter to a given value.</p>
    <aside data-element="aside">
      <p data-element="p">To change the value of an existing counter use counter-set, or counter-increment.</p>
      <p data-element="p">To change the value of an existing counter use counter-set, or counter-increment.</p>
    </aside>
    <p data-element="p">The counter-reset CSS property resets a CSS counter to a given value.</p>
    <section data-element="section">
      <p data-element="p">To change the value of an existing counter use counter-set, or counter-increment.</p>
      <p data-element="p">To change the value of an existing counter use counter-set, or counter-increment.</p>
    </section>
  </div>
</div>

<div class="form">
  <span>counter-increment:</span>
  <label for="none">
    <input type="radio" name="counter-increment" value="none" id="none" checked />
    none
  </label>
  <label for="counter-increment">
    <input type="radio" name="counter-increment" value="heading section" id="counter-increment" />
    heading section
  </label>
</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;
  justify-content: center;
  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%;
  max-width: 60vw;
}

.counter-reset > * {
  margin: 1rem 0;
}

.counter-reset > * {
  /*   display: flex;
  align-items: center; */
}

section {
  border: 1px solid currentColor;
  padding: 10px;
}

aside {
  border: 1px dotted currentColor;
  padding: 10px;
}
.counter-reset *::before {
  display: inline-flex;
  color: #fff;
  background-color: #f36;
  padding: 10px;
  line-height: 1;
  font-size: 2rem;
  margin-right: 20px;
  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%;
}

.counter-reset *::after {
  content: "(" attr(data-element) "  Element)";
  font-size: 85%;
  line-height: 1;
  color: #5c2;
  margin-left: 5px;
}

.form {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(0 0 0 / 0.8);
  color: #fff;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  text-shadow: 1px 1px 0 rgb(255 125 125 / 0.8);
}

label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.counter-reset {
  counter-reset: heading section 2;
}

.counter-reset * {
  counter-increment: var(--counter-increment, none);
}

.counter-reset h1::before {
  content: counter(heading);
}

.counter-reset p::before {
  content: counters(section, ".");
}
const rootElement = document.documentElement;
const inputs = document.querySelectorAll('input[type="radio"]');

inputs.forEach((input) => {
  input.addEventListener("click", (etv) => {
    rootElement.style.setProperty(`--${etv.target.name}`, 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.