I want to create the following layout:

It is a strip of a variable number of images with different widths and heights, which:
- proportional
- scales at the same height;
- and the sum of their width is equal to the parent width.
*** It is difficult to express oneself;
I was wondering if it is possible for a block to mimic the img behavior of a neat proportion when you set the width as a percentage, and it magically calculates its auto height.
I have compiled a diagram that perhaps better explains what I want to achieve:

I want the image to have a 100% collective width of the parent element, scaled at the same height without losing their share.
I tried various implementations, trying to figure out a way that I can translate the calculation of the percentage height to css, which fills the entire width for the block, how the image works when there are properties {width: 100%; height : auto} {width: 100%; height : auto} .
So here is what I got so far:
Strike # 1, tried a simple solution
Problem: container height must be predetermined.
.container { width : 100%; border: 1px solid black; height: 50px; } .image-wrapper { white-space: nowrap; height: 100%; max-width: 100%; border: 1px dashed gray; } .image { height: 100%; width: auto; }
<div class="container"> <div class="image-wrapper"> <img class="image" src="http://placehold.it/100x200" /> <img class="image" src="http://placehold.it/300x200" /> <img class="image" src="http://placehold.it/800x400" /> <img class="image" src="http://placehold.it/10x80" /> <img class="image" src="http://placehold.it/800x400" /> </div> </div>
Strike # 2, display: table any?
Problem: you donβt even need to mention it, the images are cropped, the size of the container does not match its parent size.
.container-wrapper { width: 40px; height: 50px; } .container { width : 100%; border: 1px solid black; display: table; height: 100%; } .image-wrapper { display: table-row; height: 100%; border: 1px dashed gray; } .item { display: table-cell; border: 1px solid blue; width: 100%; height: auto; } .image { height: 100%; width: auto; }
<div class="container-wrapper"> <div class="container"> <div class="image-wrapper"> <div class="item"> <img class="image" src="http://placehold.it/100x200" /> </div> <div class="item"> <img class="image" src="http://placehold.it/300x200" /> </div> <div class="item"> <img class="image" src="http://placehold.it/800x400" /> </div> <div class="item"> <img class="image" src="http://placehold.it/10x80" /> </div> <div class="item"> <img class="image" src="http://placehold.it/800x400" /> </div> </div> </div> </div>
*** I have to say that I am looking for an HTML / CSS solution without JavaScript.
Do you have a clue on how I can approach this?
source share