4 Tagged | snippet

Styling link underlines in 2023

I remember years ago reading this article by Marcin Wichary about how they created custom link underlines at Medium using a lot of CSS trickery. I thought of it again when I was styling the links on my site and discovered all of the great link …

Continue reading →

Wrap element snippet

I've found myself needing to do this on a couple of projects lately so it seemed like a good idea to write it down here as a snippet to reference later. This sort of a vanilla replacement for jQuery's .wrap() method /** * Helper function to wrap one …

Continue reading →

Visually hidden snippet

There are several ways to hide content using CSS. For example using display: none, or visibility: hidden. Each way of hiding elements is useful in different situations, but this snippet is specifically for visually hiding elements while keeping the …

Continue reading →

Copyright Snippet

It's that time of year again, so I thought I'd do a quick post on the simple bit of JavaScript I use to keep the copyright date current in the static sites I build. Add the hidden attribute to your container element markup so that if JS fails for …

Continue reading →