Images & figures
Pictures that never spill out of their box, a framed thumbnail, and a picture with a caption. Inside an article, prose already does all of this.
Responsive and thumbnail
.img-fluid shrinks a picture to fit its box and keeps its shape; .img-thumbnail adds a white frame.
<img class="img-fluid w-64" src="../examples/img/sample-2.svg" alt="Violet dusk over the hills" width="1200" height="800">
<img class="img-thumbnail w-48" src="../examples/img/sample-6.svg" alt="An orange desert" width="1200" height="800">
<img class="img-thumbnail w-48 rotate-2 shadow-md" src="../examples/img/sample-1.svg" alt="Yellow hills at noon" width="1200" height="800">Figure
<figure class="figure max-w-sm">
<img src="../examples/img/sample-5.svg" alt="A blue lake between snowy mountains" width="1200" height="800">
<figcaption class="figure-caption">The lake on a still morning. Photo: the Momo team.</figcaption>
</figure>Classes
| Class | Does |
|---|---|
.img-fluid | At most as wide as its box, height follows |
.img-thumbnail | The same, in a white frame with a line |
figure.figure | A picture (rounded, with a line) and its caption |
.figure-caption | The small gray caption under it |
Always write width and height on an <img> (the file's real size): the browser keeps the space free while it loads, so the page doesn't jump. Cropping, shapes and filters are in the utilities (object-cover, aspect-*) and transforms & filters.