How can I prevent 100vh elements causing issues on the instagram browser?

52 Views Asked by At

I have some full height (100vh) elements on my home page that work fine on all browsers except for when looking at the site through an instagram browser. The dynamic navigation tab that shows and hides itself on the instagram browser causes the height to change and results in a jittery scroll. I've tried to change it to lvh or svh values, also to fix the background position to keep the heights static but it doesnt seem to work on instagram. Does anyone have any experience or advice with this?

1

There are 1 best solutions below

0
spaceman On

Try using percentage-based heights, like height: 100%. The vh unit always refers to the largest possible height. Some mobile browsers will have that navigation bar at the bottom, so vh will be equal to the viewport height + this navigation bar height. This means that when the page first loads, 100vh will actually be quite a bit taller than the viewable area.