Techno Blender
Digitally Yours.

Bootstrap 5 Images Picture – GeeksforGeeks

0 25


Improve Article

Save Article

Like Article

Improve Article

Save Article

Bootstrap 5 Picture is used to add more than one source to an image component in a webpage. This tag works the same as in normal HTML but we can use the BootStrap utilities and components with it. This is really useful to make responsive designs without using traditional techniques.

To use this, we have to add a default image tag and we can add no or multiple sources of different or even the same image. The <picture> element is used to specify multiple <source> elements for a specific <img>. Add the .img-* classes to the <img> and not to the <picture> tag.

Bootstrap5 Images Picture Class: There is no predefined class for this but you should use the .img-* class to obtain responsiveness, we can use Bootstrap 5 Responsive images to the source element tags.

Syntax:

<picture>
   <source srcset="https://www.geeksforgeeks.org/bootstrap-5-images-picture/..." type="image/svg+xml"> 
   <img src="https://www.geeksforgeeks.org/bootstrap-5-images-picture/..." class="img-fluid" alt="https://www.geeksforgeeks.org/bootstrap-5-images-picture/...">
</picture>

There are no certain used classes as such in this implementation.

Example 1: The code below demonstrates how we can add multiple images of different resolutions to make it responsive as per the viewport size using the source and img tag inside the picture tag.

Output:

Bootstrap 5 Images Picture

Example 2: The code below demonstrates how we can add multiple different images as per the viewport size using the source and img tag inside the picture tag.

Output:

Bootstrap5 Images Picture

Bootstrap 5 Images Picture

Reference: https://getbootstrap.com/docs/5.0/content/images/#picture 


Improve Article

Save Article

Like Article

Improve Article

Save Article

Bootstrap 5 Picture is used to add more than one source to an image component in a webpage. This tag works the same as in normal HTML but we can use the BootStrap utilities and components with it. This is really useful to make responsive designs without using traditional techniques.

To use this, we have to add a default image tag and we can add no or multiple sources of different or even the same image. The <picture> element is used to specify multiple <source> elements for a specific <img>. Add the .img-* classes to the <img> and not to the <picture> tag.

Bootstrap5 Images Picture Class: There is no predefined class for this but you should use the .img-* class to obtain responsiveness, we can use Bootstrap 5 Responsive images to the source element tags.

Syntax:

<picture>
   <source srcset="https://www.geeksforgeeks.org/bootstrap-5-images-picture/..." type="image/svg+xml"> 
   <img src="https://www.geeksforgeeks.org/bootstrap-5-images-picture/..." class="img-fluid" alt="https://www.geeksforgeeks.org/bootstrap-5-images-picture/...">
</picture>

There are no certain used classes as such in this implementation.

Example 1: The code below demonstrates how we can add multiple images of different resolutions to make it responsive as per the viewport size using the source and img tag inside the picture tag.

Output:

Bootstrap 5 Images Picture

Example 2: The code below demonstrates how we can add multiple different images as per the viewport size using the source and img tag inside the picture tag.

Output:

Bootstrap5 Images Picture

Bootstrap 5 Images Picture

Reference: https://getbootstrap.com/docs/5.0/content/images/#picture 

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – [email protected]. The content will be deleted within 24 hours.

Leave a comment