Reputation: 33
I have a long vertical image that overflows from a popup modal causing a scroll wheel to appear. I have already tried to use the responsive-img
class, but that does not stop the image from overflowing. The only way I can get it to stop is by setting a pixel limit, but that causes the image to look distorted and not responsive.
Upvotes: 0
Views: 75
Reputation: 361
You can set the image style like this:
img {
height: 100%;
max-width: 100%;
object-fit: contain;}
It will now 100% height of its parent, in your case is a modal, and the width is responsive.
Feel free to change it to whatever value you see best.
Upvotes: 1