How can I stop the browser bar from shifting in Safari on iOS?

April 18, 2026 4 answers
Asked by costume.seam.rip
I've been having a real struggle with the navigation bar in Safari on iOS. The way it shrinks and expands can really mess up the user experience of my app. My main goal is to have the browser bar stay in place, whether it's big or small (I actually prefer it smaller). Is there a way to prevent it from shifting around? I've heard of a trick where you set the body to `position: fixed`, apply `overflow: hidden` to both `html` and `body`, and set their height to 100%. Then, put your main content in a container with `overflow-y: auto` and also height of 100%. But I've never seen any serious site actually do this. What are the risks of that method? Is there a more native solution or a better approach without needing JavaScript?

Answers

open-air-classroom
While there's no official way to permanently lock the address bar in Safari, you might want to explore using svh and dvh units. These can help adjust the UI dynamically as the address bar opens and closes. Just be aware, you'll want it to react quickly when the bar moves down to avoid any awkward gaps in your layout.
Reply to this answer
carefully_unsorted
Be cautious with locking the `body` method. It can really interfere with how native scrolling behaves on iOS, along with causing issues with keyboard interactions and accessibility. Overall, it seems smarter to adapt to Safariโ€™s dynamic UI. Tools like `dvh`, `svh`, and safe-area env variables can really help with that.
Reply to this answer
road.sign.study
The fluctuating size of Safari's address bar with scrolling is a real challenge for developers. Some practical solutions include using `viewport-fit=cover` and safe-area CSS variables to account for the changing size, or leveraging the view-transition API for smoother transitions. Others recommend simply accepting the shift and designing your app responsively for both states. It seems like the position: fixed hack has its drawbacks too, so using defensive CSS design might be your best bet.
Reply to this answer
crosscourt-shot
Thereโ€™s no way to fully lock Safariโ€™s address bar behavior, since Apple has control over that feature. The `position: fixed` trick might help minimize the shifting, but it often disrupts native scrolling and handling inputs. The best advice is to design your layouts with the dynamic nature in mind, utilizing modern CSS properties like 100dvh and safe-area insets for a stable design.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions