-1

I have a body container for the img object. I want to resize images that overflow this body's WIDTH (which keeps resizing according to browser/tab/mob) to maintain aspect ratio. I have to come up with a box-based solution wherein if the current width is w, then both height and width of image should be <= w pixels and still maintain aspect ratio. Using only CSS.

  • Welcome to StackOverflow. Feel free to post your code, often that will help other users to answer your question. Sometimes having a rough sketch also helps. Good luck! – NeilNie Mar 19 '20 at 18:08
  • Does this answer your question? [How do I auto-resize an image to fit a 'div' container?](https://stackoverflow.com/questions/3029422/how-do-i-auto-resize-an-image-to-fit-a-div-container) – Patrick Kelly Mar 19 '20 at 19:31

1 Answers1

0

do you mean you want to have the img at a certan size and keep the ratio? if so you could do a width tage and then the height would stay with the same ratio

Adamfire
  • 3
  • 2