You need to wrap your image in a container that can help you preserve the 200px
constrain you want to apply on your image. The height will adapt to the width which is neat since you won`t have to worry about it.
The below example shows what you can do with a custom size image, from placeholdit, you can modify it as you like. I also advise you to play around with the .wrapper
width in order to identify any changes you wish to apply such as adding width: 200px; width: auto;
instead... this .wrapper
is a very flexible container and that is what you need, you can change it however you like.
EDIT
Going by the comments below, I decided to modify the wrapper of the image to force the image to lose it's aspect ratio. First, I am using a position: absolute
(you can also use position: fixed
). I also made the image dimensions completely disproportionate to the .wrapper
dimensions, to further elaborate on the necessity of losing aspect ratio.
Note: Since it is only a demonstration, I am not worrying about multiple images and how to position them properly (that is another question entirely).
.wrapper {
width: 200px;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.wrapper img {
width: 100%;
height: 100%;
}
<div class="wrapper">
<img src="http://placehold.it/1500x1000" alt="some image">
</div>
Feel free to play around with the .wrapper
to