Skip to content

Instantly share code, notes, and snippets.

@RheingoldRiver
Created May 26, 2020 12:39
Show Gist options
  • Save RheingoldRiver/9ea2ec405f8ee75eb7152eb831b2e882 to your computer and use it in GitHub Desktop.
Save RheingoldRiver/9ea2ec405f8ee75eb7152eb831b2e882 to your computer and use it in GitHub Desktop.
/*
source: https://danielpost.com/articles/making-hugos-footnotes-accessible
*/
@keyframes highlight {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.footnotes li,
.footnote-ref {
position: relative;
}
.footnotes li::after,
.single__contents a.footnote-ref::after {
position: absolute;
z-index: -1;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(
-100deg,
rgba(var(--color-footnote-highlight), 0.3),
rgba(var(--color-footnote-highlight), 0.6) 95%,
rgba(var(--color-footnote-highlight), 0.1)
);
opacity: 0;
}
.footnotes li:target::after,
.footnotes li:focus::after,
sup[id^="fnref"]:target a.footnote-ref::after,
sup[id^="fnref"]:focus a.footnote-ref::after {
animation: highlight 2s cubic-bezier(0.3, 0, 1, 0.7);
}
.single__contents a.footnote-ref::before {
content:'';
}
/* readd the correct before/after around the sup instead of the anchor */
sup[id^="fnref"]::before {
content:'[';
}
sup[id^="fnref"]::after {
content:']';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment