Main image gallery with thumbnails in HTML and CSS
A large photo with clickable thumbnails and arrows, for a product page or a property listing.
Here is an excerpt of this component's code in HTML and CSS. The full code is free for members, ready to copy into your project.
This component also comes in
The code in HTML and CSS
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Galerie grande image et vignettes</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="demo">
<section class="gvp" data-gvp aria-labelledby="gvp-titre">
<div class="gvp-stage">document.querySelectorAll("[data-gvp]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const main = root.querySelector("[data-gvp-main]");
const caption = root.querySelector("[data-gvp-caption]");
const thumbs = Array.from(root.querySelectorAll("[data-gvp-thumb]"));
let index = 0;
const show = (next) => {
index = (next + thumbs.length) % thumbs.length;
const thumb = thumbs[index];
thumbs.forEach((item) => item.removeAttribute("aria-current"));
thumb.setAttribute("aria-current", "true");:root {
--gvp-card: #ffffff;
--gvp-text: #1c2230;
--gvp-muted: #545d6e;
--gvp-accent: #1e40af;
--gvp-chip: rgb(255 255 255 / 0.94);
--demo-bg: #e8ebf2;
--demo-text: #1c2230;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {Free component: copy it freely, including for commercial projects.
Other galleries and carousels components in HTML and CSS
Galleries and carousels components in HTML and CSS
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

An Instagram-style square grid with a profile header and captions on hover, served by your own site: no social network script or cookie.
- Tailwind
- React
- CSS
- WordPress

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

YouTube videos shown as thumbnails: the player only loads on click, to respect privacy and keep the page light.
- Tailwind
- React
- CSS
- WordPress

A slideshow that fills the whole screen, browsed with the keyboard or a finger swipe, and closed with Escape.
- Tailwind
- React
- CSS
- WordPress

Projects sorted by type of work, arranged in tabs that work with the keyboard and screen readers.
- Tailwind
- React
- CSS
- WordPress