I'm using react-bootstrap and trying to add an icon to the NavBar
<Navbar.Header>
<Navbar.Brand>
<a href="#">☰ React-Bootstrap
<img src={logo} style={{width:100, marginTop: -7}} />
</a>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
However, the icon is not positioned properly in the navbar
And from the official site, i can't find any example of adding icon to the navbar.
Thanks
collapseOnSelect: It is used to collapse the Navbar on click onSelect function is triggered of a descendant of a child <nav> element. expand: It is used to denote the breakpoint below which our Navbar will collapse.
I think you will need to add a bit of CSS there.
.navbar-brand {
display: flex;
align-items: center;
}
.navbar-brand>img {
padding: 7px 14px;
}
Check working example on JSFiddle
Depending on your image size you can adjust it for your code
It's a dirty hack, but I had the same problem and added a className, 'nav-logo-' to my image and then did the following CSS:
.nav-logo {
float: left !important;
margin-top: -15px !important;
}
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