I have a situation where the image should be displayed under the heading below (not overlapping). Neither the size of the image nor the length of the inscription is known.
The height of the entire shape element should be 100% as follows:

The width of the element should be dynamic, determined by the ratio of the image, while the title should correspond to a line break. This is important because I need to display multiple images next to each other.
Is there a way that I can only achieve this with CSS?
I tried with CSS tables, but this does not work at 100% height. You can see my efforts here:
display: table
http://codepen.io/pju/pen/ZOmdEb
And with flexbox, which has its problems.
display: flex
http://codepen.io/pju/pen/QEJXNZ