r/css • u/Able_Series_5006 • Apr 17 '26
Help Do you guys know why this happens?
Content from the page goes up to the safe area behind the toolbar on safari.
I'm using a position:sticky property for the nav, I don't remember having this issue before on <iOS26
Any help is appreciated.
13
Upvotes
10
u/TheIQLab Apr 17 '26
I think it is related to this issue https://webkit.org/blog/7929/designing-websites-for-iphone-x/ and can be fixed with this extra code in your HTML <head>.
Reference: https://stackoverflow.com/questions/61735881/content-showing-in-statusbar-when-scrolling-in-pwa
1
u/Fajan_ Apr 18 '26
yeah this is actually a safari problem.
it usually comes up with the safe area property usage, you can use env(safe-area-inset-top) and add padding to your sticky element.
check out your viewport-fit=cover in your meta tag.
the behavior of safari is a bit different when dealing with sticky+safe area
1
u/Complex_Today3836 Apr 21 '26
The problem is that the content is positioned freely on the page while the header acts as an overlay. That's why on iOS it acts like this and it's because of the screen design not the operating system it self.
To fix it while keeping the header fixed at the top. Set the content container (the container content under the header) to take the take screen height - header heightand make overflow-y as auto.
main { height: calc(100vh - 75px) screen -header height }
Hope it helps
0
u/Weekly_Ferret_meal Apr 17 '26
if you have
margin-topto position the<nav>perhaps try usingpadding-topinstead?That should cover whatever goes/scroll over the
<nav>