Terence Eden poked around with a way to do footnotes using the <details>
/<summary>
elements. I think it’s kind of clever. Rather than a hyperlink that jumps down to explain the footnote elsewhere, the details are right there next to the text. I like that proximity in the code. Plus, you get the native open/close interactivity of the disclosure widget.
It’s got some tricky parts though. The <details>
element is block-level, so it needs to become inline to be the footnote, and sized/positioned to look “right.” I think it’s a shame that it won’t sit within a <p>
tag, so that makes it impractical for my own usage.
Craig Shoemaker in the comments forked the original to fiddle with the CSS, and that inspired me to do the same.
Rather than display the footnote text itself right inline (which is extra-tricky), I moved that content to a fixed-position location at the bottom of the page:
I’m not 100% convinced it’s a good idea, but I’m also not convinced it’s a terrible one.
The post A (terrible?) way to do footnotes in HTML appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter.
Subscribe to MarketingSolution.
Receive web development discounts & web design tutorials.
Now! Lets GROW Together!