Skip to content

Photo gallery with lightbox

A photo mosaic (dishes, dining room, terrace) that opens in a large lightbox with captions, a thumbnail strip, keyboard navigation and swipe.

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

Description

Designed for a restaurant, shop or tradesperson who wants to show dishes, premises or past work. The mosaic grid mixes wide, tall and square photos with no gaps, each with a short caption. The lightbox uses the native dialog element: large photo, category, title and description, counter, previous and next buttons, a clickable thumbnail strip that follows the photo on display, swipe on mobile and click on the backdrop to close. The thumbnail strip is built from the grid: adding a photo to the grid is enough. Accessibility: each photo opens through a button named "Agrandir : title"; the modal lightbox keeps focus, closes with Escape and returns focus to the original photo; left and right arrows, Home and End navigate; the counter is announced (aria-live); the active thumbnail is marked with aria-current; the full description is read with each grid photo; 44 px buttons with visible focus; AA contrast in light and dark modes; hover zoom, slide between photos and opening animation are turned off with prefers-reduced-motion. Without JavaScript the grid stays a mosaic of captioned photos, with no inert button. No dependency, JavaScript: 78 lines. CSS variables: --glb-radius (photo corner radius, from 0 to 28px for softer shapes), --glb-accent, --glb-text, --glb-muted. Gradients are replaced by your photos while keeping the alternative text.

Code

Loading the code…

The code of this component in

Archive contents

galerie-photos-lightbox-html-tailwind.zip3 files · 8 Ko

  • index.html23 Ko
  • README.md5 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