Agent Wranglers

WEB-33Recommended

Size full-height panels for phones

Size full-height phone layouts with dvh, svh or lvh instead of vh, so they fit when the address bar moves.

How to do it

Use 100dvh for panels that should track the visible area, and 100svh for layouts that must never be cut off. Keep a 100vh line before it for very old browsers. Test it at phone size as Test in more than one browser and size says.

Examples

CSS example

.menu-panel {
  height: 100vh;   /* fallback for old browsers */
  height: 100dvh;
}

How to check

A grep of the stylesheet finds no 100vh without a dvh, svh or lvh line after it.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/interface/dynamic-viewport-units">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.