“css” Articles

Progressively-enhanced dark mode

Three radio buttons labeled "Auto", "Light", and "Dark". The left half of the screen has a light background with the radio buttons dark, the right half has a dark background with light radio buttons.

Recently, I added a dark mode setting to my website. Dark mode is a color theme feature that’s pretty common these days. Letting users adjust the color of content so it’s easier to see is a nice usability improvement.

Many developers I follow have written great articles about their implementations, which are full of valuable insight. To name a few: Hidde de Vries, Sarah Fossheim, and Josh Comeau all have smart approaches with valuable takeaways.

However, I decided to take a slightly different approach than a lot of the solutions I’d seen – a progressively-enhanced version that works with or without JavaScript (JS).

Read Article

Using overflow to align oddly-sized SVGs (like avatars and icons)

A row of three avatar images featuring cartoon faces looking at each other.

When building interfaces, it's common to have a series of SVG (Scalable Vector Graphics) images that need to be aligned in some way, but the composition of the assets doesn't easily allow for it. Sometimes, you know this from the start and can plan accordingly. But other times you have to accommodate graphical changes mid-project that can be a mess to deal with.

In this article I'm going to dive into this issue and show an interesting way we can solve it by laying out our graphics a certain way in Adobe Illustrator and then displaying them on our page by modifying the CSS overflow property.

Read Article