Skip to content

Instantly share code, notes, and snippets.

@jirikuncar
Created October 31, 2019 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jirikuncar/dbbc11f6a2a17a107fa7fc3f9bbdf754 to your computer and use it in GitHub Desktop.
Save jirikuncar/dbbc11f6a2a17a107fa7fc3f9bbdf754 to your computer and use it in GitHub Desktop.
Number headers with CSS
body {
counter-reset: h2counter;
}
h1 {
counter-reset: h2counter;
}
main h2:before {
content: counter(h2counter) ".\0000a0\0000a0";
}
main h2 {
counter-increment: h2counter;
counter-reset: h3counter;
}
main h3:before {
content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0";
}
main h3 {
counter-increment: h3counter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment