I want to display images in a way that maximizes the amount of screen space used while still showing the whole picture. The images are either in portrait or landscape orientation and should be fully visible on displays in both orientations.
Currently I am using these CSS rules for my images:
max-width: 100%;
height: auto;
This does the job just fine when viewing landscape images on portrait displays, but breaks on landscape displays:
Is there a way (preferably using only CSS on modern browsers) to make the image fit in all cases?