Very similar to some answers here, but in my case I had images that sometimes were taller, sometimes larger. This style worked like a charm to make sure that all images use all available space, keep the ratio and not cuts:.img { object-fit: contain; max-width: 100%; max-height: 100%; width: auto; height: auto; } More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.