Skip to content

Gallery with captions and credits in HTML and CSS

Photos with a proper caption, the photographer's name and the reuse licence.

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

Open in a new tab

The code in HTML and CSS

index.html
<!doctype html>
<html lang="fr">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Galerie avec légendes et crédits</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <main class="demo">
      <section class="glc" data-glc aria-labelledby="glc-titre">
        <p class="glc-eyebrow">Office de tourisme du Vercors · photothèque</p>
style.css
:root {
  --glc-card: #ffffff;
  --glc-text: #1d2228;
  --glc-muted: #525b66;
  --glc-line: #dde3e8;
  --glc-accent: #0f5f74;
  --glc-soft: #e6f2f5;
  --demo-bg: #eceff2;
  --demo-text: #1d2228;
}

@media (prefers-color-scheme: dark) {

Free component: copy it freely, including for commercial projects.

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
    Component
  • Building site photos sorted by dated step on a vertical timeline, with the current step highlighted.

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

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

    • Tailwind
    • React
    • CSS
    • WordPress
    Component