2024 November

Create a 100vh section without Javascript or position:absolute / fixed (& height:100%) using dvh

I came across the dvh = „dynamic view height“ unit a couple of years ago, where the browser support was very bad.

Now we have about 95%, which should be enough for most projects – if not @supports should do the trick, so DVH could be used as an progressive enhancement.

This is particularly useful when dealing with mobile browsers that hide the address bar when scrolling.

See: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Values_and_Units

Credits @ Artur A on Stackoverflow.