I'm building a Navbar with react-bootstrap, but come across the following problem.
When I scroll to the top/right/bottom or keep the page still, everything looks fine.
But when I scroll to the left, there is a white space appear on the right of the content, making navbar exceeding the length of the main body.
Here's my script:
const HomePage = () => {
return (
<div id="homePageTitle">
<h1>Home Page</h1>
</div>
)
}
class Header extends React.Component {
render() {
return (
<div>
<Navbar inverse collapseOnSelect id="navbar">
<Navbar.Header>
<Navbar.Brand>
<p>Brand</p>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
<Nav pullRight>
<NavItem eventKey={1}>Home</NavItem>
<NavItem eventKey={2}>Projects</NavItem>
<NavItem eventKey={3}>Passions</NavItem>
<NavItem eventKey={4}>Contact</NavItem>
</Nav>
</Navbar.Collapse>
</Navbar>
<HomePage />
</div>
)};
}
Here's my css:
/*---------Header----------*/
.navbar-brand {
min-height: 100px;
}
.navbar.navbar-inverse{
width: 100%;
height: 100px;
margin-bottom: 0;
background-color: lightskyblue;
border: lightskyblue;
border-radius: 0;
position: fixed;
top: 0;
transition: opacity 0.5s;
}
.navbar-right {
margin-top: 30px;
font-size: 18px;
}
/*---------HomePage----------*/
#homePageTitle {
padding-top: 80px;
padding-bottom: 420px;
width: 100%;
text-align: center;
background-color: lightcoral;
margin: 0;
color: #507e9a;
}
Even just a clue as to why this happens is much appreciated! Thanks!