I am trying to figure out how can I apply styling to a react bootstraps NavBar. Added jsfiddle here. https://jsfiddle.net/pdqzju1e/1/ Having some issue in running the jsfiddle with react-bootstrap. Works on my locally set up environment.
const navbar = {backgroundColor: '#F16E10'};
export default class NavigationBar extends React.Component {
render() {
return (
<div>
<Navbar style={navbar}>
<Navbar.Header>
<Navbar.Brand>
<a href="/">Test App</a>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
<Nav style={navbar}>
<NavItem eventKey={1} href="#">Link1</NavItem>
<NavItem eventKey={2} href="#">Link2</NavItem>
</Nav>
<Nav pullRight>
<NavItem eventKey={1} href="#">Link3</NavItem>
</Nav>
</Navbar.Collapse>
</Navbar>
</div>
);
}
}
The above only seems to work for Nav component and not NavBar. Is there any workaround for this?
Hey Akshay you can target the
navbar-header
class to override its css attributes. Here's a jsBin demo.If that did the trick for you then I'd recommend playing around with Chrome's devtools: inspecting elements and changing their styles to see which css classes you'd want to target.