Making the new Salter Cane website

With the release of a new Salter Cane album I figured it was high time to update the design of the band’s website.

Here’s the old version for reference. As you can see, there’s a connection there in some of the design language. Even so, I decided to start completely from scratch.

I opened up a text editor and started writing HTML by hand. Same for the CSS. No templates. No build tools. No pipeline. Nothing. It was a blast!

And lest you think that sounds like a wasteful way of working, I pretty much had the website done in half a day.

Partly that’s because you can do so much with so little in CSS these days. Custom properties for colours, spacing, and fluid typography (thanks to Utopia). Logical properties. View transitions. None of this takes much time at all.

Because I was using custom properties, it was a breeze to add a dark mode with prefers-color-scheme. I think I might like the dark version more than the default.

The final stylesheet is pretty short. I didn’t bother with any resets. Browsers are pretty consistent with their default styles nowadays. As long as you’ve got some sensible settings on your body element, the cascade will take care of a lot.

There’s one little CSS trick I think is pretty clever…

The background image is this image. As you can see, it’s a rectangle that’s wider than it is tall. But the web pages are rectangles that are taller than they are wide.

So how I should I position the background image? Centred? Anchored to the top? Anchored to the bottom?

If you open up the website in Chrome (or Safari Technical Preview), you’ll see that the background image is anchored to the top. But if you scroll down you’ll see that the background image is now anchored to the bottom. The background position has changed somehow.

This isn’t just on the home page. On any page, no matter how tall it is, the background image is anchored to the top when the top of the document is in the viewport, and it’s anchored to the bottom when you reach the bottom of the document.

In the past, this kind of thing might’ve been possible with some clever JavaScript that measured the height of the document and updated the background position every time a scroll event is triggered.

But I didn’t need any JavaScript. This is a scroll-driven animation made with just a few lines of CSS.

@keyframes parallax {
    from {
        background-position: top center;
    }
    to {
        background-position: bottom center;
    }
}
@media (prefers-reduced-motion: no-preference) {
        html {
            animation: parallax auto ease;
            animation-timeline: scroll();
        }
    }
}

This works as a nice bit of progressive enhancement: by default the background image stays anchored to the top of the viewport, which is fine.

Once the site was ready, I spent a bit more time sweating some details, like the responsive images on the home page.

But the biggest performance challenge wasn’t something I had direct control over. There’s a Spotify embed on the home page. Ain’t no party like a third party.

I could put loading="lazy" on the iframe but in this case, it’s pretty close to the top of document so it’s still going to start loading at the same time as some of my first-party assets.

I decided to try a little JavaScript library called “lazysizes”. Normally this would ring alarm bells for me: solving a problem with third-party code by adding …more third-party code. But in this case, it really did the trick. The library is loading asynchronously (so it doesn’t interfere with the more important assets) and only then does it start populating the iframe.

This made a huge difference. The core web vitals went from being abysmal to being perfect.

I’m pretty pleased with how the new website turned out.

Have you published a response to this? :

Responses

Muddy Matt

Thanks - love the background-image ‘trick’ and the lazysites info could be useful too

# Posted by Muddy Matt on Saturday, February 1st, 2025 at 11:50am

Luke Dorny

@adactio Nice and lean! Impressive and inspiring to keep it simple. CSS has come so far.

I can’t wait until your tour. See you at the Edgewater. Vinyl me please.

# Posted by Luke Dorny on Saturday, February 1st, 2025 at 4:56pm

Paul Annett

Hello Jeremy 👋 Any upcoming gigs for the new album? Been listening today. And we’re back living in Brighton so it’d be nice to see you!

# Posted by Paul Annett on Saturday, February 1st, 2025 at 5:36pm

4 Shares

# Shared by Muddy Matt on Saturday, February 1st, 2025 at 12:11pm

# Shared by Scott Jenson on Saturday, February 1st, 2025 at 12:15pm

# Shared by developez on Saturday, February 1st, 2025 at 10:16pm

# Shared by Salter Cane on Tuesday, February 4th, 2025 at 5:19pm

23 Likes

# Liked by Simon Jones on Saturday, February 1st, 2025 at 11:41am

# Liked by Siggi Árni on Saturday, February 1st, 2025 at 11:41am

# Liked by Олекса 🇺🇦 on Saturday, February 1st, 2025 at 12:11pm

# Liked by Muddy Matt on Saturday, February 1st, 2025 at 12:11pm

# Liked by AlexTECPlayz on Saturday, February 1st, 2025 at 12:15pm

# Liked by strongest on Saturday, February 1st, 2025 at 12:44pm

# Liked by Ben Baker on Saturday, February 1st, 2025 at 12:45pm

# Liked by Jon Hicks on Saturday, February 1st, 2025 at 1:50pm

# Liked by felix (grayscale) 🐺 on Saturday, February 1st, 2025 at 1:50pm

# Liked by Matteo Fogli on Saturday, February 1st, 2025 at 2:51pm

# Liked by Jochen Wersdörfer on Saturday, February 1st, 2025 at 3:20pm

# Liked by Noel Jackson on Saturday, February 1st, 2025 at 3:23pm

# Liked by Luke Dorny on Saturday, February 1st, 2025 at 4:17pm

# Saturday, February 1st, 2025 at 4:40pm

# Liked by naz on Saturday, February 1st, 2025 at 5:17pm

# Liked by Thomas Vander Wal on Saturday, February 1st, 2025 at 5:17pm

# Liked by andy on Saturday, February 1st, 2025 at 6:16pm

# Liked by Jordi Sánchez on Saturday, February 1st, 2025 at 11:47pm

# Liked by Fatih Altinok on Sunday, February 2nd, 2025 at 6:28am

# Liked by Jez on Sunday, February 2nd, 2025 at 11:04am

# Liked by Cédric Luthi on Sunday, February 2nd, 2025 at 8:13pm

# Tuesday, February 4th, 2025 at 1:22am

# Liked by 205TF on Saturday, February 8th, 2025 at 2:25pm

Related posts

Style legend

Why I’d like to see one or two more elements included in the new proposal for styling form controls.

Who knows?

Had you heard of these bits of CSS? Me too/neither!

Speedier tunes

Improving performance with containment.

Assumption

Separate your concerns.

Workaround

Browsers and bugs.

Related links

CSS Form Control Styling Level 1

This looks like a really interesting proposal for allowing developers more control over styling inputs. Based on the work being done the customisable select element, it starts with a declaration of appearance: base.

Tagged with

Building WebSites With LLMS - Jim Nielsen’s Blog

And by LLMS I mean: (L)ots of (L)ittle ht(M)l page(S).

I really like this approach: using separate pages instead of in-page interactions. I remember Simon talking about how great this works, and that was a few years back, before we had view transitions.

I build separate, small HTML pages for each “interaction” I want, then I let CSS transitions take over and I get something that feels better than its JS counterpart for way less work.

Tagged with

Why I Like Designing in the Browser – Cloud Four

This describes how I like to work too.

Tagged with

una.im | Updates to the customizable select API

It’s great to see the evolution of HTML happening in response to real use-cases—the turbo-charging of the select element just gets better and better!

Tagged with

CSS wants to be a system - daverupert.com

CSS wants you to build a system with it. It wants styles to build up, not flatten down.

Truth!

Tagged with

Previously on this day

1 year ago I wrote The schedule for Patterns Day

Eight talks on design systems in one fun day.

6 years ago I wrote Ch-ch-ch-changes

Browser updates bring improvements to progressive web apps on iOS and Android.

7 years ago I wrote Global Diversity CFP Day—Brighton edition

This Saturday, February 3rd—come one, come all!

13 years ago I wrote Publishing Paranormal Interactivity

Read the transcript of my talk from An Event Apart 2010.

13 years ago I wrote dConstruct Audio Archive

Seven years of audio goodness gathered together in one place.

20 years ago I wrote Almost there...

This is pretty cool: Panic Software, makers of fine mac apps, have opened up a little store called PanicGoods. It sports a very nifty drag’n’drop interface.

20 years ago I wrote Gilding the Apple

When Apple released the G5 iMac, I professed my hope that we would soon see some third-party armatures:

22 years ago I wrote Lone Star

I’m back in Brighton.

23 years ago I wrote More tinkering with themes

In a previous entry, I was lamenting the fact that each of my themes relies on two different stylesheets which effectively rules out using an on-the-fly style switcher.

23 years ago I wrote StartupSounds

I love my Mac but I don’t think I’m quite ready to compose an entire opus about it.

23 years ago I wrote -={ PaPeR bOaTs }=-

The newest story over at thecouch.org is not only very well written, it has some great photos of Brighton’s wonderful west pier.

23 years ago I wrote Tinkering with the themes

Hopefully, you won’t notice anything different but I’ve been tinkering with the stylesheets for the various themes for the site.