Skip to content

Comments

fix: banner pushing hero below viewport fold#662

Open
RisingOrange wants to merge 6 commits intoPauseAI:mainfrom
RisingOrange:fix/hero-nav-layout-positioning
Open

fix: banner pushing hero below viewport fold#662
RisingOrange wants to merge 6 commits intoPauseAI:mainfrom
RisingOrange:fix/hero-nav-layout-positioning

Conversation

@RisingOrange
Copy link
Contributor

@RisingOrange RisingOrange commented Feb 21, 2026

Fixes #661

What

When a banner is active, the hero section (height: 100vh) starts below it and extends off-screen, breaking the full-viewport effect.

Before After

Note: The screenshots also show how the mobile layout is incorrectly used on vertical desktop instead of the desktop layout. This will be fixed by #668

How

Key changes:

  • New page-top wrapper wraps both the banners and hero-section. On hero pages it becomes a height: 100dvh flex column, so its children share the full viewport height.
  • Banners moved inside page-top (previously they were in normal flow above .layout). They take their natural height, leaving the rest for the hero.
  • hero-section moved out of .layout and into page-top, where it gets flex: 1 to fill whatever space the banners don't use.
  • Hero height changed from 100vh to 100%, so it fills its flex parent instead of the full viewport.
  • Nav width explicitly constrained to min(var(--page-width), 100vw - 6rem) — the nav is absolutely positioned inside hero-section, which moved from the width-constrained .layout to full-width page-top. This constraint replicates the width it previously inherited, keeping all container-query-based layout calculations unchanged.
  • Flex overflow fixmin-height: 0 on .hero-section overrides the flex item default min-height: auto, which caused the hero image's intrinsic size to inflate the flex item on wide viewports, squishing banners to zero height (Firefox). flex-shrink: 0 on banner elements prevents future shrinkage. .hero min-height capped with min() to avoid overflow on short viewports.

Before (hero page):

<BannerOrNearbyEvent />           <!-- normal flow, pushes layout down -->
<CampaignBanner />                <!-- normal flow, pushes layout down -->
<div class="layout hero-page">
  <div class="hero-section">      <!-- position: relative -->
    <Hero />                      <!-- height: 100vh — overflows viewport -->
    <Header />                    <!-- nav: position: absolute over hero -->
  </div>
  <main /><Footer />
</div>

After (hero page):

<div class="page-top hero-page">  <!-- NEW: height: 100dvh; flex column -->
  <BannerOrNearbyEvent />         <!-- takes natural height -->
  <CampaignBanner />              <!-- takes natural height -->
  <div class="hero-section">      <!-- flex: 1; min-height: 0; position: relative -->
    <Hero />                      <!-- height: 100% — fills remaining space -->
    <Header />                    <!-- nav: position: absolute over hero -->
  </div>
</div>
<div class="layout hero-page">    <!-- hero-section moved to page-top -->
  <main /><Footer />
</div>

Testing

  • Homepage with active banner: hero bottom at viewport fold at scroll position 0
  • Dismiss banner: hero expands to fill full 100dvh
  • Resize viewport: hero adjusts without JS
  • Nav layout unchanged at desktop, ~850px, and mobile widths
  • Non-hero pages: layout unchanged
  • Wide viewport (2560px+) with banner: banner visible, hero fills remaining space (Firefox)

@netlify
Copy link

netlify bot commented Feb 21, 2026

👷 Deploy request for pauseai pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 547d1fa

@RisingOrange RisingOrange force-pushed the fix/hero-nav-layout-positioning branch 2 times, most recently from 9865125 to 818274f Compare February 21, 2026 15:57
@RisingOrange RisingOrange marked this pull request as ready for review February 21, 2026 16:13
@RisingOrange RisingOrange mentioned this pull request Feb 21, 2026
@RisingOrange RisingOrange changed the title Fix banner pushing hero below viewport fold fix: banner pushing hero below viewport fold Feb 21, 2026
@Wituareard
Copy link
Collaborator

Seems to cut off the banner under Firefox for wide viewports
grafik

Wrap banners and hero-section in a flex column container (page-top) with
height: 100dvh on hero pages, so the hero fills whatever vertical space
remains after banners. Change Hero height from 100vh to 100% to fill
the flex child. Fix layout grid rows for hero pages (main + footer only).
The nav (position: absolute, left: 0, right: 0) now lives in page-top
(full viewport width) instead of inside .layout (40rem max, 3rem padding).
This caused --cqw container-query values to change, breaking logo positioning
and link spacing.

Fix: constrain the nav's absolute position to the same width as .layout's
content area (min(100%, page-width) - 6rem), centered via margin-inline: auto.
Previous fix wrongly applied: min(100vw, page-width) - 6rem

With box-sizing: content-box, .layout's content area (where hero-section
lives) is min(page-width, 100vw - 6rem) — the padding is subtracted from
the viewport, not from the max-inline-size. The correct formula matches
the actual content-box width of .layout.

Previously gave 544px at 800px viewport; correct is 640px.
@RisingOrange RisingOrange force-pushed the fix/hero-nav-layout-positioning branch from a9f49be to 4aeab4d Compare February 23, 2026 23:03
On wide viewports (2560px+), the hero image's intrinsic aspect ratio
inflated the hero-section flex item via min-height: auto, overflowing
the 100dvh container and collapsing banners to zero height.

- Add min-height: 0 on .hero-section to override flex min-height: auto
- Add flex-shrink: 0 on banner flex items to prevent future shrinkage
- Cap .hero min-height with min() so it can't exceed parent on short viewports
@RisingOrange
Copy link
Contributor Author

@Wituareard

Seems to cut off the banner under Firefox for wide viewports

Good catch! Fixed in 547d1fa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Banner pushes hero below viewport fold

2 participants