View Single Post
Old 07-05-2022, 07:23 PM   #1
daudvyd
Junior Member
daudvyd began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2022
Device: Kindle Paper White
cross-referencing in an EPUB?

I'm writing with Sigil. I'd like to automatically number figure captions using a CSS counter and then reference that counter in inline content such as "...see Figure 4..." where the number "4" is automatically produced and updated as I add more figures and shuffle their order. My understanding from these examples is that I can use an id tag to identify which figure caption I want to reference and target-counter to get the counter. The code below numbers the figure captions, but cannot get those numbers afterward to put inline. So, (1) I've written it incorrectly, (2) Sigil does not implement this CSS feature, or (3) both (1) and (2). Can anyone help?

Code:
<p>See Fig <a href="#fig3items">000</a></p>
<figure>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<figcaption id="fig3items">Three Items</figcaption>
</figure>
Code:
body {
counter-reset: chapter;
counter-reset: figure;
counter-increment: chapter 5;
}

figure figcaption {
	counter-increment: figure;
}

figure figcaption:before {
	content: "Figure " counter(chapter) "-" counter(figure) ": ";
}

a::after {
  content: target-counter(attr(href, url),figure)}
daudvyd is offline   Reply With Quote