Skip to content

index2.html: fix fixed navbar overlapping hero content on mobile#116

Merged
ThomasWaldmann merged 1 commit into
sourcefrom
fix-mobile-navbar-overlap
Jun 22, 2026
Merged

index2.html: fix fixed navbar overlapping hero content on mobile#116
ThomasWaldmann merged 1 commit into
sourcefrom
fix-mobile-navbar-overlap

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Problem

Reported in discussion #9768: on mobile the page title/logo is hidden behind the top nav bar, and scrolling up snaps back to it.

On narrow screens (max-width: 640px) the fixed header.top switches to a stacked column layout and the nav links wrap to several rows, so the header grows to ~170px tall — well past the hero's fixed 6rem (96px) top padding. Because the hero content is vertically centered, the logo and h1 ended up sitting behind the fixed navbar.

Fix

Offset the hero's top padding by the actual measured header height. --header-h is already computed in JS (used for section scroll-margin-top), so the hero now uses:

padding: max(6rem, calc(var(--header-h, 62px) + 1.5rem)) 1.5rem 4rem;
  • Mobile: header ≈170px → top padding becomes ~194px, content clears the navbar.
  • Desktop: header is shorter than 6rem, so the 6rem value still wins — look unchanged.

Verification

Tested locally with a browser preview:

Viewport Header height Hero top padding Logo top Overlap
375px (mobile) 170px 194px 194px none
1280px (desktop) 55px 96px (6rem) 104px none

🤖 Generated with Claude Code

On narrow screens the fixed top header switches to a stacked column
layout and the nav links wrap to several rows, so the header grows to
~170px tall — well past the hero's fixed 6rem top padding. With the hero
content vertically centered, the logo and title ended up hidden behind
the navbar (reported in discussion #9768).

Offset the hero's top padding by the measured header height
(--header-h, already set in JS) via max(6rem, --header-h + 1.5rem), so
the content always clears the header. Desktop is unaffected: the header
is shorter than 6rem there, so the 6rem value still wins.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ThomasWaldmann ThomasWaldmann merged commit c92336b into source Jun 22, 2026
@ThomasWaldmann ThomasWaldmann deleted the fix-mobile-navbar-overlap branch June 22, 2026 21:52
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.

1 participant