How to adjust image size to fit a div with Bootstrap and HTML?

Spread the love

Sometimes, we want to adjust image size to fit a div with Bootstrap and HTML.

In this article, we’ll look at how to adjust image size to fit a div with Bootstrap and HTML.

How to adjust image size to fit a div with Bootstrap and HTML?

To adjust image size to fit a div with Bootstrap and HTML, we add the img-fluid class.

For instance, we write

<div class="container">
  <div class="col-md-4 px-0">
    <img src="images/food1.jpg" class="img-fluid" />
  </div>
</div>

to add the img-fluid class to the img element to make it fit the parent div.

Conclusion

To adjust image size to fit a div with Bootstrap and HTML, we add the img-fluid class.

Leave a Reply

Your email address will not be published. Required fields are marked *