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

Bootstrap4 Image Shapes

Bootstrap4 Image Shapes

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-right class to right-align an image, and the .float-left class to left-align an image:

Example

<img src="paris.jpg" class="float-left">
<img src="cinqueterre.jpg" class="float-right">

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 »