Skip to content

Fixed nav reserves no space — header overlaps content on any page without a hero #12

Description

@Schmandarine

Found while building a real site in Docker (WP 7.0.2 + SCF).

.site-nav is position: fixed; top: 0 with a transparent background, designed to sit over a hero section. Nothing reserves space for it:

.site-nav{ position:fixed; top:0; background:rgba(0,0,0,0); … }
.site-main{ flex:1 }        /* no padding-top, no margin-top */

It works by accident when the first block is a .section (padding-top: 8rem clears the nav). On any page whose first block is not a full-bleed hero, the content slides underneath the header.

Worst case, before #— the home page was seeded: an empty page made the fixed header land directly on the footer, so header and footer rendered as one band and the nav was unreadable. That was the first thing anyone scaffolding the theme saw.

Seeding the home page with a hero (88e4565) hides this on the front page only. sample-page and any new page still hit it.

Options

  1. padding-top: var(--site-nav-height) on .site-main, and let hero blocks pull themselves up with a negative margin when they want to sit under a transparent nav.
  2. A body class — has-hero vs not — set from whether the first block is full-bleed, with the offset applied only when there is no hero.
  3. Make the nav sticky rather than fixed on non-hero pages.

Option 1 is the smallest change and the least surprising; option 2 is what the design seems to assume.

Acceptance

A page whose first block is an ordinary constrained section renders fully below the nav, with no overlap, at every breakpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions