🜃 CSS Hover Footnote

282 2026-07-24 snippet

The trick behind the footnotes on this site and the hover previews in notes like Colour Theory is the same adjacent-hover pattern, just with different content in the hidden span. It's AetherAnne's pattern for footnotes without JavaScript, wired through markdown-it's renderer overrides here instead of hand-written HTML:

.fn-wrapper {
  position: relative;
  display: inline-block;
}

.fn-content {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  max-width: 30ch;
}

.fn-wrapper:hover .fn-content,
.fn-wrapper:focus-within .fn-content {
  display: block;
}

The reference and the hidden content are wrapped in one position: relative span. .fn-content needs a positioned ancestor to anchor position: absolute against, and same-level siblings don't count.

See Symbol Taxonomy for other design patterns, and Transclusion for the other place this hover pattern is reused.