I have three counters for my top three headings. I'm trying to get the current h1's content, and its counter in the header of pages. However, counter(h1) always evaluated to 0. See my comments below:
body { counter-reset: h1 h2 h3; }
h1 {
counter-reset: h2 h3;
string-set: section counter(h1) ' ' content(); /* "0 Header 1": why is it 0? */
}
h1:before {
counter-increment: h1;
content: counter(h1) '.0 ';
}
h2 { counter-reset: h3; }
h2:before {
counter-increment: h2;
content: counter(h1) '.' counter(h2) ' ';
}
h3:before {
counter-increment: h3;
content: counter(h1) '.' counter(h2) '.' counter(h3) ' ';
}
@page {
@top-center {
content: string(section); /* when I used counter(h1) here it was 0 too */
}
}
body { counter-reset: h1 h2 h3; }
h1 {
counter-reset: h2 h3;
string-set: section counter(h1) ' ' content(); /* "0 Header 1": why is it 0? */
}
h1:before {
counter-increment: h1;
content: counter(h1) '.0 ';
}
h2 { counter-reset: h3; }
h2:before {
counter-increment: h2;
content: counter(h1) '.' counter(h2) ' ';
}
h3:before {
counter-increment: h3;
content: counter(h1) '.' counter(h2) '.' counter(h3) ' ';
}
@page {
@top-center {
content: string(section); /* when I used counter(h1) here it was 0 too */
}
}