Applying the max-height and overflow-y .body to .body and not to .wrap ...?
Change 1:
So far, nothing has fallen within the limits, which suggests either JavaScript or deviations from the restrictions (using% for the height of the header or px margin ).
Edit 2:
Here's the initial demo using% for the header height. I added the min-height tag to the title tag so that the title hardly disappears on very small screens due to the top edge (which is reduced on very small screens).
On the screen> = 400px high it should work exactly as required (40px header with 10% height). If the title was reduced in height, it would support slightly smaller screens (a 30px title with a height of 10% would support screens> = 300 pixels). Here is a demo with a 30px header.
These are clumsy solutions, but this is the only thing that turned out to be without using JavaScript.
Also, note that I added the h2 and .content and moved padding:10px; there padding:10px; to avoid combining% height and padding in the same elements (which results in a higher height than the specified% value).
source share