I want to create a Navbar
with the containing elements place at the center. I am using React, Bootstrap 4 and reactstrap.
I have the following reactstrap JSX code:
<div>
<Navbar className="d-flex justify-content-center" color="faded" light expand="md">
<NavbarBrand href="/">reactstrap</NavbarBrand>
<NavbarToggler />
<Collapse navbar>
<Nav navbar>
<NavItem>
<NavLink href="/components/">Components</NavLink>
</NavItem>
<NavItem>
<NavLink href="https://github.com/reactstrap/reactstrap">Github</NavLink>
</NavItem>
<UncontrolledDropdown nav inNavbar>
<DropdownToggle nav caret>
Options
</DropdownToggle>
<DropdownMenu >
<DropdownItem>
Option 1
</DropdownItem>
<DropdownItem>
Option 2
</DropdownItem>
<DropdownItem divider />
<DropdownItem>
Reset
</DropdownItem>
</DropdownMenu>
</UncontrolledDropdown>
</Nav>
</Collapse>
</Navbar>
</div>
The problem is that the elements of the Navbar are aligned to the left instead of in the center:
After looking here, I thought this would work:
className="d-flex justify-content-center"
However, it doesn't work.
Also, after looking here, I tried changing the second line to this:
<Navbar xs="6" sm="4" color="faded" light expand="md">
However, this doesn't work either.
So, how I make the elements of the Navbar
centered.