Bootstrap 4 tutorial

Content (2): Images

Images

Responsive images

Set .img-fluid to img . It scales to the parent width if the image is wider than the parent.

img.img-fluid

Responsible image

Image thumbnails

img.rounded rounds corners of an image (⇒ Border-radius ).

Rounded image

img.img-thumbnail shows an image with a rounded 1px border.

Thumnail image

Aligning images

Use .float-(left|right) to float an image on left or right (⇒ Float)

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

.mx-auto (⇒ Spacing ) can be used to center a fixed-width block element

Text alignment .text(left|center|right) (⇒ Text alignment ) can be also used.

img inside div.text-left

img inside div.text-center

img inside div.text-right

Using picture

picture can be used to switch images with a viewport size. The folowing example changes an image on breakpoint boundaries.