๐ฑ Solved: iOS Home Screen web app (PWA) gap at the bottom in portrait
Your PWA, added to the iPhone Home Screen and opened upright, stops one status bar short of the bottom edge. Here is what we measured, the CSS fix that removed it, and everything that did not work. ๐ฉน
โก TL;DR: the fix
If your page has viewport-fit=cover, apple-mobile-web-app-status-bar-style set to
black-translucent, and a root sized with 100dvh (or 100%), size the root with
100vh in the installed app only:
/* iOS PWA bottom gap fix: github.com/LivingSparks10/ios-pwa-status-bar-gap */
html, body { height: 100%; height: 100dvh; } /* browser tab */
@media (display-mode: standalone), (display-mode: fullscreen) {
html, body { height: 100vh; } /* Home Screen app: full screen */
}
iOS still launches the app short, then grows it to the full screen within about a second (0.4โ0.9 s in our tests)
and fires a resize. No need to add the icon again: iOS reads the CSS at every launch. โ
โ This fix took 25 launches and 21 phone rotations to find. If it saved you time: buy me a coffee on Ko-fi.
๐งช Try it on your iPhone
Two test pages that differ only in the root's height. Open each one in Safari, tap Share โ Add to Home Screen, then open the new icon with the phone upright.
๐ฅ dvh.html: root100dvh (shows the band)
๐ฉ vh.html: root 100vh (the fix)
Green to the bottom edge means no band; a red band at the bottom is the bug.
๐ The symptom
- The page uses
black-translucentandviewport-fit=cover: drawn behind the status bar, full screen. - Launched from the Home Screen in portrait, the app is shorter than the screen by exactly the top safe-area inset.
On a 430 ร 932 pt iPhone:
innerHeight873, screen 932,env(safe-area-inset-top)59. - iOS paints the leftover band with the
htmlbackground colour. No element, fixed or not, is drawn there. - Rotating to landscape and back fixes it. With the rotation lock on, the band stays for the whole session. ๐
- Landscape is always fine. A normal Safari tab is fine.
People describe it as: PWA white bar at the bottom, gap at the bottom of a standalone web app, bottom safe area not filled, 100dvh too short in PWA, empty space below the content on iPhone after Add to Home Screen. It is the same thing.
๐ What we measured
The page logged its viewport to a server at every launch and every event, plus every 100 ms for the first
seconds. iPhone with a 430 ร 932 pt screen, iOS 18.2, December 2026. At launch in portrait, root at 100dvh:
| Measure | At launch | After rotating and back |
|---|---|---|
innerHeight, visualViewport.height | 873 | 932 |
100dvh / 100svh | 873 / 873 | 932 / 873 |
100vh / 100lvh | 932 / 932 | 932 / 932 |
documentElement.clientHeight | 873 | 873 |
env(safe-area-inset-top) / -bottom | 59 / 34 | 59 / 34 |
display-mode, navigator.standalone | fullscreen, true | same |
So iOS already knows the full height at launch: 100vh is 932. Only the viewport the page lives in is short.
๐ฌ The variants
The server served a different variant at each launch; the tester only relaunched the app and marked what they saw.
| Variant | Height after 4 s | Band |
|---|---|---|
original (root 100dvh, overflow: hidden) | 873 | ๐ฉ yes |
root 100vh | 932 | ๐ no (2 of 2) |
root with no height and no overflow | 873 | yes (2 of 2) |
| viewport meta of a page that fills the screen | 873 | yes |
viewport meta with height=device-height, shrink-to-fit=no | 873 | yes |
no theme-color meta | 873 | yes |
Then the fix in the real app, scoped to display-mode: standalone and fullscreen:
3 launches out of 3 without the band, with rotations back and forth. It launched at 873 and reached
932 after 398, 714 and 857 ms.
๐ซ What did not work
| Attempt | Result |
|---|---|
App elements at 100lvh (932), root at 100dvh | Elements are 932 tall, the band stays: nothing is drawn past 873 |
Status bar default or black | The band moves to the top and becomes an opaque status bar |
Manifest without orientation, standalone instead of fullscreen | Same band |
Rewriting the viewport meta at runtime, scrollTo, a fake resize, focus/blur tricks | innerHeight stays 873 |
Laying the page out with screen.height | Content past 873 is cut off โ๏ธ |
Many write-ups conclude that no CSS can fix this and switch the status bar to default, giving up the
full screen. On our iPhone the root's height unit made the difference.
๐ค Why it works (our reading, not confirmed by Apple)
At launch in portrait, the app starts one status bar short. iOS then seems to size the app to fit the page: a root
of 100dvh matches the short viewport, so nothing changes. A root of 100vh (932) is taller
than the app, and iOS grows the app to the full screen. This is an observation, not documented behaviour.
๐งญ Things to know when you apply it
- Scope it to the installed app. In a browser tab
100vhcan be taller than the visible area. - Do not freeze your layout at launch. The size changes once, within about a second, with a
resize. Measure your canvas again then. - Fixed elements follow:
position: fixed; inset: 0reaches the bottom once the app has grown. - Pad for the home indicator with
env(safe-area-inset-bottom)where controls sit at the bottom.
๐ซ The cost of this bug
A game that worked fine, except for one band at the bottom. It took more hours than we'd like to admit. The real numbers from the debug log:
| ๐ App launches logged | 25 |
| ๐ Phone rotations logged | 21 (plus countless unlogged ones out of spite) |
| ๐งช Variants written / tried on the phone | 14 / 9 |
| ๐ Lines of viewport log | 375 |
| ๐๏ธ Test icons added to and removed from the Home Screen | lost count |
| ๐ฎ Unrelated web games opened โfor researchโ | a few (one of them filled the screen, so a fix had to exist) |
| โ๏ธ Characters in the final fix | about 30 |
If this saved you from rotating your phone 21 times, a coffee is very welcome โ
โ Buy me a coffee on Ko-fi๐ฎ Reports from other devices
Tested so far on one iPhone (430 ร 932 pt), iOS 18.2. Reports from iOS 26 and 27 describe a band
that no element can reach, possibly a different regression. Tell us what dvh.html and
vh.html show on yours:
open a device report ๐
๐ Related
- WebKit bug 254868: incorrect height values when
viewport-fit=coveris set for installed web apps - WebKit bug 301994: installed web app no longer drawn behind the status bar (iOS 26)
- The dead band in your iOS web app is not your CSS: the
black-translucentdiagnosis - PWA iOS Explorer: live test page for viewport and status bar settings