Bootstrap5 Image Shapes
Bootstrap 5 provides many classes to help you quickly adjust and optimize the appearance of images, especially controlling the shape, size, and responsive layout of images.
Rounded Image
.roundedThe class can make images display rounded corner effects:
Oval Image
.rounded-circleThe class can create oval images:
Thumbnail
.img-thumbnailThe class is used to set image thumbnails (images have borders):
Image Alignment
Use.float-startclass to align images left, use.float-endclass to align images right:
Example
<img src="paris.jpg" class="float-start">
<img src="cinqueterre.jpg" class="float-end">
Try it Yourself »
Centered Image
Use.mx-auto (margin:auto)and .d-block (display:block)classes to center images:
Responsive Image
Images come in various sizes, and we need to automatically adapt based on the screen size.
We can add the<img>class to the.img-fluidtag to set responsive images.
.img-fluidThe class setsmax-width: 100%; 、 height: auto; :
Other Extensions