I have an image inside of a div which I need to have as large as possible. I have tried using
One of the more elegant solutions is to set the size of the div, then set its background to
url(foo) cover. This chops off the edges if need be. Using
contain instead of
cover does the same, but without chopping off the edges.
Edit: Per comments, I suggested using
object-fit: contain. No need to downvote over my suggestion to use a background image.