Search code examples
htmlcsstailwind-css

Tailwind h-screen doesn’t work properly on mobile devices


The h-screen class which should set the height as the height of the screen doesn’t work on iOS. Is there a way to fix that?


Solution

  • Faced the same problem, and found out that we could use dvh (dynamic viewport height).

    h-[calc(100dvh)] instead of h-screen.

    However, it's better to add a fallback, just in case.