I am hoping that this is a simple question, and I see that some folks have asked a similar question about bootstrap. I haven't been able to work one of those answers into a solution that works for me, and I think there may be a simpler react-bootstrap answer in any case.
Code example is here: https://codesandbox.io/s/yq5jvl9lz9
Here's what it looks like, when the viewport is wide enough:
Here's more-or-less what I want:
Your help will be greatly appreciated! Thanks, Nat
EDIT 12/22/18: Starting with the information from @Cristian below, I modified the example. I needed display: inline-block
in addition to width: 100%
. Unfortunately, at larger screen sizes, the "brand" is now mis-aligned with the menu items:
Any other fixes appreciated! I have posted this as a fresh question, so answers can go there (and points for accepted answer!)
The solution to your problem would be styling the navbar-brand or any other element by using text-align: center however, this will not work unless you also specify width: 100% .
You can move the nav elements to the center by putting text-align:center on the ul because the list elements have been set to inline-block which means they can be centred in the same way that you can centre text.
By default, navs are left-aligned, but you can easily change them to center or right aligned. Centered with . justify-content-center : Active.
I think className='m-auto'
at Nav
is enough
I had the same question, and this worked for me:
Add className="justify-content-center"
to the parent.
Example:
<Navbar className="justify-content-center">
<Navbar.Brand/>
</Navbar>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With