I have something like the following Css:
Now I would like to create a cross reference to a chapter.
For references to a H1 chapter this is quite easy:
But for references to chapters of "type" H2?
And what if I change a referenced chapter from H1 to H2 or vice versa?
div.book { counter-reset: h1 h2 }
div.book h1 { counter-increment: h1; counter-reset: h2 }
div.book h2 { counter-increment: h2 }
div.book h1::before { content: counter(h1) " " }
div.book h2::before {
content: counter(h1) "." counter(h2) " "
}
Now I would like to create a cross reference to a chapter.
For references to a H1 chapter this is quite easy:
a[href]::after {
content: " [See chapter " target-counter(attr(href), h1) "]"
}
But for references to chapters of "type" H2?
And what if I change a referenced chapter from H1 to H2 or vice versa?