CSS-only horizontally-scrolling cards with snapping

allanwhite

Allan White

Posted on October 17, 2019

CSS-only horizontally-scrolling cards with snapping

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.

💖 💪 🙅 🚩
allanwhite
Allan White

Posted on October 17, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Subgrid
undefined Subgrid

November 29, 2024

#CodePenChallenge: Wall of Text
codepen #CodePenChallenge: Wall of Text

November 29, 2024

Body fluids & circulation Task
codepen Body fluids & circulation Task

November 28, 2024

Flip Card on Hover in CSS
codepen Flip Card on Hover in CSS

November 27, 2024

Backlight in CSS
codepen Backlight in CSS

November 27, 2024