Wanting to display 2 responsive images without having the browser reflow the screen as the images are loaded. I am currently using a modified version from this answer: responsive-design, image, how to set width/height to avoid reflow on image-load
Here is the fiddle for a single responsive image: https://jsfiddle.net/hxraak4u/
HTML
<div class="image-wrapper" style="max-width: 608px; ">
<div style="padding-bottom: 49.34%; "> <!-- Height / Width -->
<img src="http://met.live.mediaspanonline.com/assets/31069/example-608web_w608.jpg" style="max-height: 300px;" />
</div>
</div>
CSS
.image-wrapper {
margin: 15px auto;
page-break-inside: avoid;
}
.image-wrapper div {
position: relative;
height: 0;
overflow: hidden;
}
.image-wrapper div img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Note: I'm using some inline styles are because I am using Razor to create the HTML for the image and to set the width, height, and height/width (bottom padding %).
I am now trying to get 2 different height images to display side by side while preserving what I already have working. Specifically:
- different height images to display side by side
- images are centered in their parent div
- images are not displayed larger than 100%
- have these 2 images stack vertically if the width of the display decreases to be less than the width of either of the 2 images
- if the display shrinks further, shrink the width of the images as necessary while preserving the width:height ratio - standard responsive UI
- when printing, don't break images over pages, whether it be 2 images on a row or one, but don't require both images together to not break over a page when they are on different rows
- when the HTML is loaded, reserve vertical space for each image based on the width of the display and the width/height ratio - prevent reflow