Forum How do I...?

Is it possible to add a link to the TOC page

mknight
Hi there

I have been asked to add a link back to the table of contents, on the footer of each page.

Is that possible?

Thanks

Matt
howcome
Yes, you can use "running elements" to have links in margin areas.

https://css4.pub/2024/running-headers/#running-elements

Code snippets from the example on that page:

@page{
    @top-right {
        content: element(header);
    }
}

div.math {
  position: running(header);
}
...

<div class=math>The <a href=https://en.wikipedia.org/wiki/Equation_solving>solution</a> is: <math><msqrt><mi>x</mi></msqrt></math></div>

Edited by howcome

mknight
Thanks for replying!

Apologies, but I realise now that I did not word my post very clearly.

It is the link to the TOC that I unsure about. I think I'm okay with adding a link to the footer.

As our TOC is automatically generated on publication, I'm not sure how to point the href to the TOC page.
howcome
You can do:

<div id=toc>
[automatically generated toc]
</div>

<div class=footer><a href=#toc>link to toc</a></div>


Here's a guide to generating ToCs automatically:

https://css4.pub/2024/toc

Edited by howcome