'How to make CSS counter to count just headings, not pages
I have a problem with a counter of headings in a pdf document. Counter for headings should be correspondent to their TOC (Table of contents), but for some reason, it counts pages, especially if there are multiple pages.
Below is an example of my current code:
body {
counter-reset: h1count 0 h2count 0 h3count 0;
}
.pagetitle {
page-break-before: always;
}
h1 {
counter-reset: h2count;
counter-increment: h1count;
}
h2 {
counter-reset: h3count;
counter-increment: h2count;
}
h3 {
counter-increment: h3count;
}
h1:before {
content: counter(h1count)". ";
}
h2:before {
content: counter(h1count)"." counter(h2count)" ";
}
h3:before {
content: counter(h1count)"." counter(h2count)"." counter(h3count)" ";
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
