Simplify

I was messing about with some images on a website recently and while I was happy enough with the arrangement on large screens, I thought it would be better to have the images in a kind of carousel on smaller screens—a swipable gallery.

My old brain immediately thought this would be fairly complicated to do, but actually it’s ludicrously straightforward. Just stick this bit of CSS on the containing element inside a media query (or better yet, a container query):

display: flex;
overflow-x: auto;

That’s it.

Oh, and you can swap out overflow-x for overflow-inline if, like me, you’re a fan of logical properties. But support for that only just landed in Safari so I’d probably wait a little while before removing the old syntax.

Here’s an example using pictures of some of the lovely people who will be speaking at Web Day Out:

Jemima Abu Rachel Andrew Lola Odelola Richard Rutter Harry Roberts

While you’re at it, add this:

overscroll-behavior-inline: contain;

Thats prevents the user accidentally triggering a backwards/forwards navigation when they’re swiping.

You could add some more little niceties like this, but you don’t have to:

scroll-snap-type: inline mandatory;
scroll-behavior: smooth;

And maybe this on the individual items:

scroll-snap-align: center;

You could progressively enhance even more with the new pseudo-elements like ::scroll-button() and ::scroll-marker for Chromium browsers.

Apart from that last bit, none of this is particularly new or groundbreaking. But it was a pleasant reminder for me that interactions that used to be complicated to implement are now very straightforward indeed.

Here’s another example that Ana Tudor brought up yesterday:

You have a section with a p on the left & an img on the right. How do you make the img height always be determined by the p with the tiniest bit of CSS? 😼

No changing the HTML structure in any way, no pseudos, no background declarations, no JS. Just a tiny bit of #CSS.

Old me would’ve said it can’t be done. But with a little bit of investigating, I found a nice straightforward solution:

section >  img {
  contain: size;
  place-self: stretch;
  object-fit: cover;
}

That’ll work whether the section has its display set to flex or grid.

There’s something very, very satisfying in finding a simple solution to something you thought would be complicated.

Honestly, I feel like web developers are constantly being gaslit into thinking that complex over-engineered solutions are the only option. When the discourse is being dominated by people invested in frameworks and libraries, all our default thinking will involve frameworks and libraries. That’s not good for users, and I don’t think it’s good for us either.

Of course, the trick is knowing that the simpler solution exists. The information probably isn’t going to fall in your lap—especially when the discourse is dominated by overly-complex JavaScript.

So get yourself a ticket for Web Day Out. It’s on Thursday, March 12th, 2026 right here in Brighton.

I guarantee you’ll hear about some magnificent techniques that will allow you to rip out plenty of complex code in favour of letting the browser do the work.

Have you published a response to this? :

Responses

Martin Bavio

Excellent blog post. Sounds like we need more of this to counteract for the discourse dominated by overly-complex JavaScript.

Matthias Ott

“Honestly, I feel like web developers are constantly being gaslit into thinking that complex over-engineered solutions are the only option. When the discourse is being dominated by people invested in frameworks and libraries, all our default thinking will involve frameworks and libraries. That’s not good for users, and I don’t think it’s good for us either.”

Mic drop by @adactio 👏https://adactio.com/journal/22178

Simplify

Sara Soueidan

I loved this, except for the part where Jeremy suggests using the CSS carousel pseudo-elements knowing how problematic they still are for users. :/

hirsebirse

@matthiasott @adactio That’s why I teach my trainees aaaaall the basics. The have a better understanding of web technology than my “Seniors” … The old dudes always throw in tech to solve a problem and make everything way too complicated. #sigh

sigh

# Posted by hirsebirse on Friday, October 10th, 2025 at 10:34am

Curtis Wilcox

@adactio Support for overflow logical properties may have recently landed in Safari but what hasn’t landed in Safari is support for automatically adding scrollable areas to the focus order. Without that, keyboard users can’t scroll to see all the images.

Solving that means either always having tabindex=0 on the container, even if it’s not scrollable at all viewport sizes, or adding JavaScript to dynamically add it when needed.

And when an author adds elements to the focus order, they really should make sure those elements have a role and a name to make their purpose clear for screen reader users (even though in this case they may not care since they don’t need to use the scroll to access the content). `role=”group”` is a typical choice and while a content specific name is best (e.g. `aria-label=”Web Day speakers”`) a reusable component might have a generic one (“scrolled content”).

The CSS is just as simple but the full consideration of the design is not so simple.

Curtis Wilcox

@adactio To further complicate it, client-side language translation often misses `aria-label` values so to prevent that `aria-labelledby` should be used which means adding another element with a unique id for it to reference.

“`HTML<div id=”scrolled-content” style=”display: none;”>scrolled content</div><div role=”group” aria-labelledby=”scrolled-content”>…“`

Or maybe the content should have had a heading all along and that can be used for a name.

“`HTML<h2 id=”web-day-speakers”>Web Day Speakers</h2><div role=”group” aria-labelledby=”web-day-speakers”>…“`

8 Shares

# Shared by Nic Chan on Thursday, October 9th, 2025 at 10:30am

# Shared by Andy Bell on Thursday, October 9th, 2025 at 10:59am

# Shared by John Allsopp on Thursday, October 9th, 2025 at 11:30am

# Shared by Bramus on Thursday, October 9th, 2025 at 11:30am

# Shared by Bramus on Thursday, October 9th, 2025 at 11:38am

# Shared by Seyfeddin Bassarac on Thursday, October 9th, 2025 at 3:30pm

# Shared by Mastro on Thursday, October 9th, 2025 at 4:48pm

# Shared by zeldman on Thursday, October 9th, 2025 at 8:11pm

31 Likes

# Liked by Nic Chan on Thursday, October 9th, 2025 at 10:30am

# Liked by Niels van Rongen on Thursday, October 9th, 2025 at 10:37am

# Liked by Andrew Maier on Thursday, October 9th, 2025 at 10:37am

# Liked by David Bushell 👻 on Thursday, October 9th, 2025 at 10:59am

# Liked by https://feed.city/c/dan on Thursday, October 9th, 2025 at 11:06am

# Liked by David Attrache on Thursday, October 9th, 2025 at 11:09am

# Liked by Adam Perfect on Thursday, October 9th, 2025 at 11:09am

# Liked by Martin Bavio on Thursday, October 9th, 2025 at 11:30am

# Liked by Chris Coyier on Thursday, October 9th, 2025 at 11:30am

# Liked by Dan Danowski on Thursday, October 9th, 2025 at 11:30am

# Liked by Gina Trapani on Thursday, October 9th, 2025 at 11:30am

# Liked by Robert Lin on Thursday, October 9th, 2025 at 11:30am

# Liked by zeldman on Thursday, October 9th, 2025 at 11:30am

# Liked by James [[Insert Scary Name Here]] Harris on Thursday, October 9th, 2025 at 11:30am

# Liked by Raspy on Thursday, October 9th, 2025 at 11:38am

# Liked by davepermen on Thursday, October 9th, 2025 at 12:02pm

# Liked by Phil Hawksworth on Thursday, October 9th, 2025 at 12:02pm

# Liked by Aaron T. Grogg on Thursday, October 9th, 2025 at 12:27pm

# Liked by Griffin Wiebel 🧟‍♂️ on Thursday, October 9th, 2025 at 12:27pm

# Liked by Lennart Schoors on Thursday, October 9th, 2025 at 12:27pm

# Liked by bgrift on Thursday, October 9th, 2025 at 12:53pm

# Liked by Tobias Baldauf on Thursday, October 9th, 2025 at 1:02pm

# Liked by Jordi Sánchez on Thursday, October 9th, 2025 at 1:27pm

# Liked by strongest on Thursday, October 9th, 2025 at 1:39pm

# Liked by eh on Thursday, October 9th, 2025 at 2:04pm

# Liked by John Warne on Thursday, October 9th, 2025 at 2:34pm

# Liked by John Mueller on Thursday, October 9th, 2025 at 2:54pm

# Liked by Kevin H-C on Thursday, October 9th, 2025 at 3:19pm

# Liked by Mastro on Thursday, October 9th, 2025 at 4:15pm

# Liked by magrolino on Friday, October 10th, 2025 at 6:50am

# Liked by Marko Bajlovic on Sunday, October 12th, 2025 at 8:25am

Related posts

Harry Roberts is speaking at Web Day Out

This line-up just gets better and better! You’ll want to be in Brighton on March 12th, 2026.

Streamlining HTML web components

Some handy tips courtesy of Chris Ferdinandi.

Command and control

HTML’s new `command` attribute on the `button` element could be a game-changer.

The web on mobile

Technically, websites can do just about anything that native apps can do. And yet the actual experience of using the web on mobile is worse than ever.

Progressively enhancing maps

How I switched to high-resolution maps on The Session without degrading performance.

Related links

Software can be finished - Ross Wintle

There’s quite a crossover between resilience and longevity:

  1. Understand the requirements
  2. Keep scope small and fixed
  3. Reduce dependencies
  4. Produce static output
  5. Increase Quality Assurance

Tagged with

V7: Video Killed the Web Browser Star | Rob Weychert

Grrr… it turns out that browsers exhibit some very frustrating behaviour when it comes to the video element. Rob has the details…

Tagged with

Optimizing PWAs For Different Display Modes — Smashing Magazine

There’s really good browser support for display-mode media queries and this article does a really good job of running through some of the use cases for your progressive web app.

Tagged with

Why I’m Writing Pure HTML & CSS in 2025

  • Building HTML pages is easy
  • Pure HTML is evergreen
  • Bloated web pages are too slow
  • I can host it anywhere, often for free
  • Accessibility and SEO benefits are automatic
  • It won’t need security patches
  • There are no build steps

Tagged with

Baseline Newly Available: Stay on Top of New Web Features - The New Stack

Grrr…

Chrome, Edge and Firefox updates usually reach 95% of users within three months. But Safari updates are tied to a new release of the underlying operating system, so they take around 19 months to reach the same usage, and some updates may even need a new device.

This is so shameful. And glad as I am to see new features landing in Safari, as long as they hobble updates like this it’s all just pissing in the wind.

Tagged with

Previously on this day

9 years ago I wrote The Rational Optimist

Not rational, not optimistic.

10 years ago I wrote Links from a talk

Further reading related to my talk at An Event Apart Austin.

16 years ago I wrote Password unmasking

Borrowing a smart UI feature from Apple.

24 years ago I wrote The Effects of September 11 on the Leading Search Engine

First Monday have posted an article about how Google responded to the September 11th attacks.