Skip to content

Horizontal scrolling gallery

A strip of cards that scrolls horizontally with snapping, by touch, wheel or with previous / next buttons.

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

To show a selection (creations, products, models) without taking much height, this gallery lines cards up on a strip that scrolls horizontally with scroll-snap: each card stops neatly in place, by touch or wheel. Previous / next buttons move by one visible width; they use aria-disabled at the ends, so focus stays on the button when you reach the end, and scrolling is instant when the user asked for reduced motion. The strip itself is focusable and named so it scrolls with the arrow keys. It is all CSS and a few lines of script, with no carousel library and no autoplay. Three cards visible on large screens, one and a half on mobile to hint at more, 44 px targets, visible focus, AA contrast in light and dark mode, no horizontal page scrolling from 360 px. Example: a florist's creations of the week.

Code

Loading the code…

The code of this component in

Archive contents

galerie-defilement-horizontal-html-tailwind.zip3 files · 5 Ko

  • index.html9 Ko
  • README.md4 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • A product photo that zooms in under the pointer, and from the keyboard with Enter and the arrow keys, to inspect the details.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Building site photos sorted by dated step on a vertical timeline, with the current step highlighted.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component