19.7 C
Canberra
Thursday, March 5, 2026

iOS Safari safe-area/standing bar reveals stable background as an alternative of permitting content material to scroll behind it (viewport-fit=cowl + fastened header) [closed]


I’m testing a React/Tailwind website on an iPhone (Safari). I need the web page content material (hero picture/background) to scroll behind the iOS standing bar / notch space, however as an alternative the highest safe-area area stays a stable coloration (BLACK) (appears just like the web page background is “painted” behind the standing bar).

I have already got:

<meta title="viewport" content material="width=device-width, initial-scale=1.0, maximum-scale=1, viewport-fit=cowl" />

My header is place: fastened, and the remainder of the web page scrolls usually.

Anticipated

The hero/background ought to visually prolong behind the standing bar space (like many native-style websites/apps), with the fastened navbar nonetheless sitting beneath the notch (protected space).

Precise

The area behind the standing bar is a stable coloration and doesn’t present the scrolling content material behind it.

Related CSS (Tailwind + customized base kinds)

@layer base {
  :root {
    --background: 26 39% 93%;
    --foreground: 255 5% 15%;
  }

  html {
    background-color: hsl(var(--background));
  }

  physique {
    @apply bg-background text-foreground antialiased;
    min-height: 100dvh;
    margin: 0;
  }

  #root {
    min-height: 100dvh;
  }
}

I consider html/physique background is what Safari is utilizing to fill the safe-area area, however I’m undecided what the right setup is.

Header (fastened)

<header className="fastened inset-x-0 top-0 z-50 px-4 pt-4">
  ...
</header>

Query

What’s the right method to arrange background + protected space in order that:

  1. The content material can visually prolong behind the standing bar/notch (viewport-fit=cowl)

  2. The standing bar space just isn’t a stable background

  3. The fastened header nonetheless respects the protected space (doesn’t collide with the notch)

If the answer is to make html/physique clear and transfer the background to a wrapper, what’s the really helpful sample for React/Tailwind?

What I attempted

  • Added viewport-fit=cowl

  • Tried adjusting safe-area padding (env(safe-area-inset-top))

  • However the prime area nonetheless appears stable (not exhibiting the content material behind it)

Additional context

That is solely taking place on iOS Safari. Desktop browsers look regular.

iOS Safari safe-area/standing bar reveals stable background as an alternative of permitting content material to scroll behind it (viewport-fit=cowl + fastened header) [closed]

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles