Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
Two Navbar rows in React-Bootstrap

I am trying to mimic this Navbar:

enter image description here

In React-Bootstrap, I am thinking of having two Navbars both on top of each other, for this I have added these files:

MainNav.tsx

import React from 'react';
import { Navbar, Container, Nav } from 'react-bootstrap';

export default function MainNav() {
  return (
    <Navbar expand="md" className="justify-content-center navbar-top" fixed="top">
      <Nav className="me-auto">
        <Navbar.Brand href="#home">Minimal Blog</Navbar.Brand>
      </Nav>
    </Navbar>
  )
}

Navbar.tsx:

import React from 'react';
import { Navbar, Container, Nav } from 'react-bootstrap';

export default function NavigationBar() {
  return (
    <Navbar expand="md" className="justify-content-center navbar-top" fixed="top">
        <Nav className="me-auto">
          <Nav.Link href="#home">Blog</Nav.Link>
          <Nav.Link href="#features">About</Nav.Link>
        </Nav>
    </Navbar>
  )
}

And in the App.tsx, I am just adding these:

<MainNav />
<Navbar />

But seems like they are super imposing on each other, I have created a code sandbox here: https://codesandbox.io/s/peaceful-sun-se4ni?file=/src/App.tsx for Replication, any help/hints in making the desired output possible will be helpful.

EDIT 1: I have added two Navbars, and utilised the z-index property, but somehow, I am not able to align contents together. Here is the sandbox link: https://codesandbox.io/s/peaceful-sun-se4ni?file=/src/App.tsx

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

the problem is that both of these navbars has the CSS property of position: fixed; so they are intertwining with each other to fix the issue you can override the CSS property by giving elements a class that would have a position:unset property

about 4 years ago · Juan Pablo Isaza Report

0

In app.tsx You're importing NavigationBar but you're writing You don't need two navbars, you need one navbar and align the elements that you on the right.

Check these examples https://getbootstrap.com/docs/4.0/components/navbar/#containers

I think you need mr or something like that.

about 4 years ago · Juan Pablo Isaza Report

0

With regards to EDIT 1, you have a container wrapped around your main nav and not in the second component. That's what is causing the alignment issue.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!