Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Bootstrap5 Image Shapes

Bootstrap5 Image Shapes

Bootstrap 5 provides many classes to help you quickly adjust and optimize the appearance of images, especially controlling image shape, size, and responsive layout.

Rounded Images

The .rounded class can give an image rounded corners:

Example

<img src="cinqueterre.jpg" class="rounded" alt=">

Cinque Terre

"

Try it »


Oval Images

The .rounded-circle class can set an oval (circular) image:

Example

<img src="cinqueterre.jpg" class="rounded-circle" alt=">

Cinque Terre

"

Try it »


Thumbnails

The .img-thumbnail class is used to set a thumbnail image (image with a border):

Example

<img src="cinqueterre.jpg" class="img-thumbnail" alt=">

Cinque Terre

"

Try it »


Image Alignment

Use the .float-start class to align an image to the left, and the .float-end class to align an image to the right:

Example

<img src="paris.jpg" class="float-start">
<img src="cinqueterre.jpg" class="float-end">

Try it »


Center the image

Use the .mx-auto (margin:auto) and .d-block (display:block) classes to center an image:

Example

<img src="paris.jpg" class=">

mx-auto d-block

"

Try it »


Responsive Images

Images come in all kinds of sizes, and we need them to adapt automatically to the screen size.

We can add the .img-fluid class to the tag to set a responsive image.

The .img-fluid class sets max-width: 100%; and height: auto;:

Example

<img class="img-fluid" src="img_chania.jpg" alt="Chania">

Try it »