Bootstrap 5 Image

In Bootstrap 5, handling images is simple and offers various utilities for styling, responsiveness, and alignment. Here's a guide to using images effectively:

Image Shapes:

Bootstrap provides utility classes to create rounded, circular, or thumbnail-style images:

Rounded Corners

Paris

Circle

NYC

Thumbnail

San Fran

Class

Effect

.rounded

Adds rounded corners

.rounded-circle

Makes the image circular

.img-thumbnail

Adds padding and a border

Example
<img src="/assets/images/building1.jpg" class="w-100 rounded" alt="Cinque Terre" >
<img src="/assets/images/building2.jpg" class="w-100 rounded-circle" alt="Cinque Terre" >
<img src="/assets/images/building3.jpg" class="w-100 img-thumbnail" alt="Cinque Terre" >

Try it yourself

Image Alignment:

Align images using utility classes.

Class

Alignment

.float-start

Left-aligned

.float-end

Right-aligned

.mx-auto d-block

Center-aligned

Example
<img src="/assets/images/building1.jpg" class="float-start" style="width:25%" >
<img src="/assets/images/building2.jpg" class="float-end" style="width:25%">
<img src="/assets/images/building3.jpg" class="mx-auto d-block" style="width:25%">

Try it yourself

Responsive Images:

To make images responsive, add the class .img-fluid. This ensures the image scales with its parent container.

Example
<img src="/assets/images/building2.jpg" class="img-fluid">

Try it yourself


Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.