Bootstrap 5 Images Picture – GeeksforGeeks

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:

Bootstrap 5 Images Picture

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

 

Stay connected with us on social media platform for instant update click here to join our  Twitter, & Facebook We are now on Telegram. Click here to join our channel (@TechiUpdate) and stay updated with the latest Technology headlines. For all the latest Technology News Click Here 

Read original article here

Denial of responsibility! FineRadar is an automatic aggregator around the global media. All the content are available free on Internet. We have just arranged it in one platform for educational purpose only. 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 on our website, please contact us by email – abuse@fineradar.com. The content will be deleted within 24 hours.
Bootstrapfineradar updateFree Fire Redeem Codesgadget updateGeeksforGeeksimagesLatest tech newsPictureTech Headlinestech newsTech News UpdatesTechnologyTechnology News
Comments (0)
Add Comment