DEV Community

Discussion on: How to make a div the same height as the browser window

Collapse
 
iamschulz profile image
Daniel Schulz

Working with vh can be tricky on mobile devices. The browser UI pops in and out, changing the usable viewport height, while 100vh stays the same. Depending on how you define 'browser window', svh, lvh and dvh or even a mix of those with clamp() might be a better solution.

The same goes for vw and scrollbars, by the way. A use case for that would be Safari, which displays a solid scrollbar when a mouse is connected, and a self-collapsing one with touchpads.

Collapse
 
smpnjn profile image
Johnny Simpson

you are right, on mobile it's confusing with collapsing navigation items. Kind of dumb it doesn't solve itself automatically.