An Interest In:
Web News this Week
- March 27, 2024
- March 26, 2024
- March 25, 2024
- March 24, 2024
- March 23, 2024
- March 22, 2024
- March 21, 2024
October 17, 2019 11:03 pm GMT
Original Link: https://dev.to/allanwhite/css-only-horizontally-scrolling-cards-with-snapping-pl0
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.
Original Link: https://dev.to/allanwhite/css-only-horizontally-scrolling-cards-with-snapping-pl0
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To