How to fix CSS 100vh not constant in mobile browser?

Spread the love

Sometimes, we want to fix CSS 100vh not constant in mobile browser.

In this article, we’ll look at how to fix CSS 100vh not constant in mobile browser.

How to fix CSS 100vh not constant in mobile browser?

To fix CSS 100vh not constant in mobile browser, we can use calc.

For instance, we write

height: calc(100vh - calc(100vh - 100%));

to set the height of the container to calc(100vh - calc(100vh - 100%)).

We subtract 100vh byt calc(100vh - 100%) to make the height of the page container constant.

Conclusion

To fix CSS 100vh not constant in mobile browser, we can use calc.

Leave a Reply

Your email address will not be published.