<!doctype html>
<head>
<style>
.flex { display: flex }
img { max-height:100%; max-width:100%; }
body, html { height:100% }
html { overflow:hidden }
</style>
</head>
<body>
<div class="flex">
    <div class="flex">
        <div>
             <img src="resources/blue-1500-2000-px.png">
        </div>
    </div>
</div>
</div>
<script>
document.body.offsetWidth
document.body.style.width = '20%'
document.body.offsetHeight
</script>

