demo · v140

Nested TOC

Multi-level table-of-contents numbering — 1., 1.1, 1.1.1 — driven by counters() in both the visual content and the alt text. The visual side reads "1.2.3"; the screen-reader side reads "Subsection one dot two dot three".

  1. Foreword
    1. About the author
  2. Getting started
    1. Installing the toolchain
    2. The hello world example
      1. JS
      2. HTML
  3. Going further
    1. Routing
    2. State management

Visual numbering uses the same counters() call as the alt text — but the two sides are joined by the new / separator in content.

li::before {
  content:
    counters(section, ".") ". "          /* visible: "1.2.3. " */
    /
    "Subsection " counters(section, " dot ") " — ";  /* alt: "Subsection 1 dot 2 dot 3 — " */
}

see also