CSS-only horizontally-scrolling cards with snapping
Allan White
Posted on October 17, 2019
It's a common design problem to have content cards to lay out in different arrangements in various viewports. In this exploration, I wanted to see how cards might be more effectively organized using a simple design pattern of a scrolling horizontal list. Try it on mobile:
It's implemented with CSS, and doesn't require any scripting for the layout or interactions. Lozad is used for lazy-loading.
There's some nice hover effects in place, CSS custom properties, and I use a simple CSS mask gradient on the edge to indicate there are more cards. To-do: Enable tabindex
for accessibilty.
I experimented with more robust CSS grid layout for the cards, but I found after playing with it on mobile it was overkill.
Posted on October 17, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.