Query:
- How can I control the max-width of an image in Bootstrap 4 without losing its responsiveness?
Context:
- Bootstrap 4's
.img-fluid
class ensures images remain responsive.
The image is set to scale with the parent element by utilizing max-width: 100%; and height: auto; (https://getbootstrap.com/docs/4.1/content/images/)
Current Issue:
- Refer to JS Fiddle: https://jsfiddle.net/aq9Laaew/290257/
- I am dealing with a large image that needs resizing.
I have specified
max-width: 500px
(using inline styling), which successfully sets the width of the image.Challenge: However, the image fails to resize when the window size changes – losing its responsiveness.
Hoping for some clear guidance on this matter; I've searched for similar queries but haven't found a solution. Thank you!