When you use percentage for height there must be something to base the percentage height on otherwise the height defaults to auto.
For height:100% to work there must be an unbroken chain of parents that also have height:100% defined all the way back to root (HTML).
Without a doctype the browser goes into quirks mode (which basically assumes that the author doesn’t know what they are doing) and will try and guess what you meant.
You should always have a doctyoe or browsers will make different assumptions about your code.
The vh unit is the modern way to get viewport height and needs no chain back to root. You will also need to negate margins on the body (and any parent wrappers) or the element will be taller than the viewport.