I'm trying to create a layout that require the display of images. I've tried to deal with it just by using width: 100%; height: auto;
, but the ratio of the image is always going to ruin the appearance of the page.
For example:
https://jsfiddle.net/iDaniel19/sLrntpcw/1/
I've been looking at paid templates/ websites to see how they deal with images and all of them use a fixed height, width depending what size looks good on page.
I'm using bootstrap classes like col-xs-3
. Now let's assume a user uploads a picture 1230x415 or 415x1230. Now I have 2 approaches to display it on the page:
Use
width: 100%; height: auto;
. This will mess with the appearance of the layout.Contain the image in the width decided by
col-xs-3
and some predefined height. This will mess with the aspect ratio of the image.Crop the image ??
How does one actually deal with images uploaded by the user and keeping the page look good?