Skip to content

Image

Utility classes for responsive images, thumbnails, and object-fit control.

When to use

  • Making images responsive within fluid layouts
  • Displaying image thumbnails with borders
  • Controlling how images fill their containers

Responsive image

Scales with parent container, never exceeds natural width.

Thumbnail

Adds padding, border, and rounded corners for a framed look.

Object fit

Control how an image fills its container.


CSS classes

ClassDescription
.img-fluidmax-width: 100%; height: auto — responsive scaling
.img-thumbnailBordered thumbnail with padding and radius
.img-coverobject-fit: cover — fills container, crops excess
.img-containobject-fit: contain — fits inside container, letterboxed

Accessibility

  • Always provide a descriptive alt attribute
  • Decorative images: use alt="" and aria-hidden="true"
  • Use <figure> and <figcaption> for images with captions — see Figure