Content
Images
Responsive images, thumbnails, alignment and the picture element.
Nothing on this page is theme-specific beyond the colours: the thumbnail border is cream-300 (navy-500 in
dark) and its radius is the 6px $border-radius. The examples use inline SVG placeholders so
the docs ship no external assets.
Responsive images
Images are made responsive with .img-fluid. This applies max-width: 100%; and
height: auto; to the image so that it scales with the parent width.
HTML
<svg class="img-fluid" width="100%" height="250" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Responsive image" preserveAspectRatio="xMidYMid slice"><rect width="100%" height="100%" fill="var(--bs-secondary-bg)"/><text x="50%" y="50%" fill="var(--bs-secondary-color)" dy=".3em" text-anchor="middle">Responsive image</text></svg><img src="..." class="img-fluid" alt="...">
Image thumbnails
In addition to the border-radius utilities, you can use
.img-thumbnail to give an image a rounded 1px border appearance with .25rem of padding in
the body colour.
HTML
<svg class="img-thumbnail" width="200" height="200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: A generic square placeholder image with a cream border and 6px radius"><rect width="100%" height="100%" fill="var(--bs-secondary-bg)"/><text x="50%" y="50%" fill="var(--bs-secondary-color)" dy=".3em" text-anchor="middle">200×200</text></svg><img src="..." class="img-thumbnail" alt="...">
Aligning images
Align images with the float utilities or
text alignment classes. block-level images can be
centered using the .mx-auto margin utility.
HTML
<div class="clearfix">
<svg class="rounded float-start" width="200" height="200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 200x200"><rect width="100%" height="100%" fill="var(--bs-secondary-bg)"/><text x="50%" y="50%" fill="var(--bs-secondary-color)" dy=".3em" text-anchor="middle">Float start</text></svg>
<svg class="rounded float-end" width="200" height="200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 200x200"><rect width="100%" height="100%" fill="var(--bs-secondary-bg)"/><text x="50%" y="50%" fill="var(--bs-secondary-color)" dy=".3em" text-anchor="middle">Float end</text></svg>
</div><img src="..." class="rounded float-start" alt="...">
<img src="..." class="rounded float-end" alt="...">
HTML
<svg class="rounded mx-auto d-block" width="200" height="200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 200x200"><rect width="100%" height="100%" fill="var(--bs-secondary-bg)"/><text x="50%" y="50%" fill="var(--bs-secondary-color)" dy=".3em" text-anchor="middle">Centered block</text></svg><img src="..." class="rounded mx-auto d-block" alt="...">
HTML
<div class="text-center">
<svg class="rounded" width="200" height="200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 200x200"><rect width="100%" height="100%" fill="var(--bs-secondary-bg)"/><text x="50%" y="50%" fill="var(--bs-secondary-color)" dy=".3em" text-anchor="middle">Centered inline</text></svg>
</div><div class="text-center">
<img src="..." class="rounded" alt="...">
</div>
Reboot sets vertical-align: middle on <img> and <svg>,
which removes the baseline gap under an inline image. For a hard square crop use the
ratio helper with object-fit.
Picture
If you are using <picture> to specify multiple <source> elements for a
specific <img>, make sure to add the .img-* classes to the
<img> and not to the <picture> tag.
<picture>
<source srcset="poster.avif" type="image/avif">
<source srcset="poster.webp" type="image/webp">
<img src="poster.jpg" class="img-fluid img-thumbnail" alt="Event poster">
</picture>
The same rule applies to dark-mode art: pair a <source media="(prefers-color-scheme: dark)">
with the light default. The page follows the OS automatically, so the two will always agree unless an
ancestor pins data-bs-theme.
Sass
Variables
The thumbnail variables, resolved against this theme's tokens:
$thumbnail-padding: .25rem;
$thumbnail-bg: var(--bs-body-bg); // cream-100 / navy-900
$thumbnail-border-width: var(--bs-border-width); // 1px
$thumbnail-border-color: var(--bs-border-color); // cream-300 / navy-500
$thumbnail-border-radius: var(--bs-border-radius); // 6px
$thumbnail-box-shadow: var(--bs-box-shadow-sm); // not applied: $enable-shadows is false