Being a web developer is as much a blessing as it is a curse. One moment you’re reading an article about the most untradable players in the NBA by your favorite basketball author, the next you’re creeping around the footnote implementation of their site and wondering if Javascript is really necessary there.1

Of course it isn’t. There are games written completely in CSS. And they are also the solution to our problem. Both examples rely on differently styled or hidden, but still accessible input controls.

One way to achieve the latter is to surround the input with a label, then hide the input. Clicking the content will trigger a click on the invisible checkbox as well:

2  <input type="checkbox" style="display:none;" />
3  The actual content

Inside the label there will also be the footnote content, like this:

1<label class="footnoteBox">
2  <input type="checkbox" />
3  <span class="footnoteBox-content">Born in 1963.</span>
4  <span class="footnoteBox-element">Michael Jordan</span>

The key part is that the footnote content comes right after the input so that we can use the CSS adjacent sibling selector +.

 1/* hide checkbox in any case */
 2.footnoteBox > input {
 3  display: none;
 6/* hide content by default */
 7.footnoteBox > .footnoteBox-content {
 8  display: none;
11/* show when checkbox is checked */
12.footnoteBox > input:checked + .footnoteBox-content {
13  display: block;
14  position: absolute; /* don’t interrupt the text flow */

What’s left is the styling of the footnote box as you please. Here is a working example. The familiar superscript number can be achieved with an after element.


  • No code.
  • Multiple footnote boxes can be visible at the same time (could also be a disadvantage when they overlap though).
  • A click anywhere inside the box hides it again. You could even create a fake close button without having to maintain code for it.


  • The markup has to be generated—e.g. from your favorite markdown parser—and it’s not only quite specific, but also ugly and useless without the accompanying CSS. I doubt your favorite markdown parser would accept a PR, but maybe you could use your own implementation.
  • Clicking outside the box won’t close it. This would be better and more expected UX—thanks, Bootstrap modals.
  1. Of course footnotes at the end of the document don’t need Javascript. But jumping back and forth is distracting so most of the time there’s also a tooltip of sorts.