Le mur · Contenu et médias · 04·10 · nouvelle pièce
Galerie
Aligner plusieurs images légendées en grille, de deux à quatre colonnes, qui passe en une colonne sur téléphone.
01Quand l'employer
Pour une série de photos, les niveaux d'un jeu, les plats d'un carnet. Il n'y a pas de visionneuse : l'image ne s'agrandit pas. Pour des cartes avec texte, la grille.
02Variantes
Deux colonnes
ch-gallery--2 : des images 16 : 9 plus grandes.
-
Niveau 1 · La plaine -
Niveau 2 · La crête -
Niveau 3 · La cave -
Niveau 4 · Le sommet
<ul class="ch-gallery ch-gallery--2" role="list">
<li class="ch-gallery__item">
<figure class="ch-figure">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M0 6h16v3H0z' fill='%232b2b29'/%3E%3Cpath d='M0 6.2h16' stroke='%235c5c58' stroke-width='.2'/%3E%3C/svg%3E" width="640" height="360" alt="Capture du niveau un : une plaine balayée par le vent">
<figcaption class="ch-figure__caption">Niveau 1 · La plaine</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M0 9 4 3.5 6.5 6.5 9.5 2 16 9z' fill='%232b2b29'/%3E%3Cpath d='M7 9 11 5 14 9z' fill='%235c5c58'/%3E%3C/svg%3E" width="640" height="360" alt="Capture du niveau deux : une crête rocheuse">
<figcaption class="ch-figure__caption">Niveau 2 · La crête</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M6 9V3h4v6z' fill='%232b2b29'/%3E%3Cpath d='M9 6h.4' stroke='%238c8c88' stroke-width='.3'/%3E%3C/svg%3E" width="640" height="360" alt="Capture du niveau trois : l'entrée d'une cave">
<figcaption class="ch-figure__caption">Niveau 3 · La cave</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Ccircle cx='11' cy='3.5' r='1.6' fill='%235c5c58'/%3E%3Cpath d='M0 9 3 6 6 8 9 5.5 16 9z' fill='%232b2b29'/%3E%3C/svg%3E" width="640" height="360" alt="Capture du niveau quatre : un sommet au lever du soleil">
<figcaption class="ch-figure__caption">Niveau 4 · Le sommet</figcaption>
</figure>
</li>
</ul>Trois colonnes
ul.ch-gallery (role="list") > li.ch-gallery__item > figure.ch-figure. Trois colonnes par défaut (ou ch-gallery--3), images 4 : 3.
-
Le marais à l'aube -
Le ponton -
Roseaux, 7 h 10 -
La cabane -
Filets -
Barque retournée
<ul class="ch-gallery ch-gallery--3" role="list">
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--4x3">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M0 9 4 3.5 6.5 6.5 9.5 2 16 9z' fill='%232b2b29'/%3E%3Cpath d='M7 9 11 5 14 9z' fill='%235c5c58'/%3E%3C/svg%3E" width="640" height="480" alt="Le marais à l'aube, sous la brume">
<figcaption class="ch-figure__caption">Le marais à l'aube</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--4x3">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M0 6h16v3H0z' fill='%232b2b29'/%3E%3Cpath d='M0 6.2h16' stroke='%235c5c58' stroke-width='.2'/%3E%3C/svg%3E" width="640" height="480" alt="Un ponton de bois qui avance dans l'eau grise">
<figcaption class="ch-figure__caption">Le ponton</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--4x3">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Ccircle cx='11' cy='3.5' r='1.6' fill='%235c5c58'/%3E%3Cpath d='M0 9 3 6 6 8 9 5.5 16 9z' fill='%232b2b29'/%3E%3C/svg%3E" width="640" height="480" alt="Un soleil pâle derrière les roseaux">
<figcaption class="ch-figure__caption">Roseaux, 7 h 10</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--4x3">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M6 9V3h4v6z' fill='%232b2b29'/%3E%3Cpath d='M9 6h.4' stroke='%238c8c88' stroke-width='.3'/%3E%3C/svg%3E" width="640" height="480" alt="Une cabane de pêcheur fermée">
<figcaption class="ch-figure__caption">La cabane</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--4x3">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M0 3h16M0 6h16M5.3 0v9M10.6 0v9' stroke='%232b2b29' stroke-width='.15' fill='none'/%3E%3Ccircle cx='8' cy='4.5' r='1.2' fill='%235c5c58'/%3E%3C/svg%3E" width="640" height="480" alt="Des filets tendus sur des perches">
<figcaption class="ch-figure__caption">Filets</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--4x3">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Ccircle cx='8' cy='4.5' r='3' fill='%232b2b29'/%3E%3Ccircle cx='8' cy='4.5' r='1.5' fill='%235c5c58'/%3E%3C/svg%3E" width="640" height="480" alt="Une barque retournée sur la berge">
<figcaption class="ch-figure__caption">Barque retournée</figcaption>
</figure>
</li>
</ul>Quatre colonnes, images décoratives
ch-gallery--4 avec des images carrées. Ici la légende dit déjà ce que montre l'image : alt est vide (décoratif), ce que le contrôle figure.mjs compte et affiche.
-
Soupe de potiron -
Galettes de sarrasin -
Tarte aux poires -
Pain de seigle
<ul class="ch-gallery ch-gallery--4" role="list">
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--1x1">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Ccircle cx='8' cy='4.5' r='3' fill='%232b2b29'/%3E%3Ccircle cx='8' cy='4.5' r='1.5' fill='%235c5c58'/%3E%3C/svg%3E" width="480" height="480" alt="">
<figcaption class="ch-figure__caption">Soupe de potiron</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--1x1">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M0 3h16M0 6h16M5.3 0v9M10.6 0v9' stroke='%232b2b29' stroke-width='.15' fill='none'/%3E%3Ccircle cx='8' cy='4.5' r='1.2' fill='%235c5c58'/%3E%3C/svg%3E" width="480" height="480" alt="">
<figcaption class="ch-figure__caption">Galettes de sarrasin</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--1x1">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Ccircle cx='11' cy='3.5' r='1.6' fill='%235c5c58'/%3E%3Cpath d='M0 9 3 6 6 8 9 5.5 16 9z' fill='%232b2b29'/%3E%3C/svg%3E" width="480" height="480" alt="">
<figcaption class="ch-figure__caption">Tarte aux poires</figcaption>
</figure>
</li>
<li class="ch-gallery__item">
<figure class="ch-figure ch-figure--1x1">
<img class="ch-figure__media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 9' width='16' height='9'%3E%3Crect width='16' height='9' fill='%23262626'/%3E%3Cpath d='M6 9V3h4v6z' fill='%232b2b29'/%3E%3Cpath d='M9 6h.4' stroke='%238c8c88' stroke-width='.3'/%3E%3C/svg%3E" width="480" height="480" alt="">
<figcaption class="ch-figure__caption">Pain de seigle</figcaption>
</figure>
</li>
</ul>03Dans les trois thèmes
Sombre
-
Niveau 1 · La plaine -
Niveau 2 · La crête -
Niveau 3 · La cave -
Niveau 4 · Le sommet
Clair
-
Niveau 1 · La plaine -
Niveau 2 · La crête -
Niveau 3 · La cave -
Niveau 4 · Le sommet
Chaud
-
Niveau 1 · La plaine -
Niveau 2 · La crête -
Niveau 3 · La cave -
Niveau 4 · Le sommet
04États
- Sous 800 px de fenêtre, toutes les variantes passent en une seule colonne (comme la grille). Mesuré à 375 px : une colonne, aucun élément au-delà de la fenêtre (scripts/browser/medias.mjs, et check-overflow à 375, 1024 et 1440 px).
05Accessibilité
- Liste native ul : le nombre d'images est annoncé ; role="list" garde la sémantique dans Safari malgré list-style: none.
- Chaque image a un alt (vide seulement si la légende suffit) et une légende en figcaption.
- Aucun lien ni bouton : rien à atteindre au clavier, aucune visionneuse à piéger.
06JavaScript requis
aucun