Skip to content

fix(theme): constrain navbar width to match main layout on wide displays#11782

Open
travisbreaks wants to merge 1 commit intofacebook:mainfrom
travisbreaks:fix/navbar-width-consistency
Open

fix(theme): constrain navbar width to match main layout on wide displays#11782
travisbreaks wants to merge 1 commit intofacebook:mainfrom
travisbreaks:fix/navbar-width-consistency

Conversation

@travisbreaks
Copy link

Summary

On wide screens (1400px+), the navbar stretches to the screen edges while the main content area and footer are constrained by --ifm-container-width. This creates a visual disconnect where navbar items sit far from the page content they relate to.

This PR adds two small CSS rules to constrain the navbar inner content:

  • .navbar gets justify-content: center so the inner content centers within the full-width navbar
  • .navbar__inner gets max-width: var(--ifm-container-width) and width: 100% to constrain its width while the navbar background still spans the full viewport

This matches the approach suggested in the issue and aligns with how Docusaurus v1 handled navbar width. The navbar background color/border still spans the full viewport width; only the inner content (logo, links, search) is constrained and centered.

Motivation

Closes #7562

Test plan

  • Verify navbar content is centered and constrained on wide screens (>1440px)
  • Verify navbar background still spans full viewport width
  • Verify no layout changes on screens <= 1140px (below container max-width)
  • Verify mobile navbar/sidebar is unaffected
  • Verify docs pages with sidebar still render correctly

Co-authored-by: Egger [email protected]

🤖 Generated with Claude Code

On wide screens (>1400px+), the navbar stretches to the screen edges while
the main content area and footer are constrained by --ifm-container-width.
This adds max-width to .navbar__inner and centers it within the navbar,
so navbar items align with the rest of the page content. The navbar
background still spans the full viewport width.

Closes facebook#7562

Co-authored-by: Egger <[email protected]>
@meta-cla
Copy link

meta-cla bot commented Mar 6, 2026

Hi @travisbreaks!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@netlify
Copy link

netlify bot commented Mar 6, 2026

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit d826337
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/69aa4f700e8d6000089b2842
😎 Deploy Preview https://deploy-preview-11782--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

Making navbar width consistent with the main layout on large displays

1 participant