Tech Note: Sidenotes

6 points by fcbsd


slightknack

I did this in the most cursed way possible on my blog, e.g. https://isaac.sh/daily/2026-02-02/

Essentially, each sidenote aside is an inline <span class=aside> node. Using media queries, on mobile, these notes are rendered as inline parentheticals; on desktop, I use some cursed-but-reliable CSS to float the span as an aisde:

.aside {
    position: relative;
    float: right;
    clear: right;
    width: calc(250px - 20pt);
    margin-right: -250px;
    margin-left: 20pt;
    /* ... some typography stuff */
}

I wanted my asides to look like those on Bob Nystrom's website, but without JS, and this was the closest I got. My ideal solution would be for the asides to be aligned properly in the gutter on desktop as they are now, but to appear after the paragraph on mobile. Unfortunately, I'm not aware of any way to do this, hence the parentheticals. (I suppose I could duplicate each aside, and selectively display them, but that feels easy to mess up from an authoring perspective. I use Zola fwiw, so maybe there's something clever I could do at build-time. I haven't had a ton ton of time to spend on this.) If you know a way, please let me know! I'll def write a blog post about it :P

LesleyLai

Sidenote/margin note is pretty lovely. I use it for digression rather than as a replacement for a footnote. Though a downside is that I tend to ramble too much in it.

I am currently setting their position via ad hoc inline styling (something like style="margin-top: -5rem" where margin-top is different for each margin note). Maybe I will change it to use anchor positioning.