Gallery
The gallery component is useful to display a set of large photos. For each photo, you must provide the following information:
- the URL of the full-size version (in the
hrefattribute of the anchor element), - the dimensions of the full-size version (in the
data-sizeattribute of the anchor element), - the URL of the thumbnail version (in the
srcattribute of the image element), - a caption and/or text alternative (
figcaptionelement oraltattribute).
Captions and text alternatives have different purposes, make sure you use them the right way.
Gallery
Example:
-
Lorem ipsum Duis exercitation dolore pariatur dolore. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Duis exercitation dolore pariatur dolore. -
Lorem ipsum Anim non consequat tempor exercitation ad. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim.
Medium Gallery
Example:
Small Gallery
Example:
-
Lorem ipsum Anim non consequat tempor exercitation ad. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim. -
Lorem ipsum Proident do aute cupidatat enim.
Captions
You may, and should provide a caption for every image with the figcaption element.
- By default, the caption is shown only in the viewer (cf. first image below).
- If you don't specify a caption, make sure to add a descriptive
alttext to theimgelement for accessibility purposes. - To show it in the gallery as well, use class
image-gallery__caption(cf. second image). - If you need to show a different caption in the gallery than in the viewer, leave the
figcaptionas is and add a paragraph before it with classimage-gallery__caption(cf. third image).
Captions in the gallery should be concise and consistent - either provide one for every image, or don't provide any at all.
Example: