Skip to content

Instantly share code, notes, and snippets.

@bultas
Created January 24, 2019 11:05
Show Gist options
  • Save bultas/6d3b0c8891734956d0811aefb9dadf9b to your computer and use it in GitHub Desktop.
Save bultas/6d3b0c8891734956d0811aefb9dadf9b to your computer and use it in GitHub Desktop.
CSS numbered Headlines
/* Fixed h3 numbering http://2ality.com/2012/01/numbering-headingshtml.html */
body {
counter-reset: h2counter;
}
h1 {
counter-reset: h2counter;
}
h2 {
counter-reset: h3counter;
}
h2:before {
content: counter(h2counter) ".\0000a0\0000a0";
counter-increment: h2counter;
}
h2.nocount:before {
content: none;
counter-increment: none;
}
h3:before {
content: counter(h2counter) "." counter(h3counter)
".\0000a0\0000a0";
counter-increment: h3counter;
}
h3.nocount:before {
content: none;
counter-increment: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment