How to align left Navbar React-Bootstrap

最后都变了- 提交于 2020-03-25 22:38:33

问题


My Navigation code as:-

    const Navigation = (props) => {
    console.log(props);
    return (
        <Navbar bg="primary" variant="dark">
            <Navbar.Brand href="/">Dating Service</Navbar.Brand>
            <Navbar.Toggle aria-controls="basic-navbar-nav" />
            <Navbar.Collapse id="basic-navbar-nav">
                <Nav className="ml-auto">
                    <Nav.Link href="/">Home</Nav.Link>
                    <Nav.Link href="/CreateProfile">Create Profile</Nav.Link>
                    <Nav.Link href="/ViewProfile">View Profile</Nav.Link>
                </Nav>
            </Navbar.Collapse>
        </Navbar>
    )
}

export default withRouter(Navigation);

It looks like this:-

The whole page is aligned center. How can make it left aligned?


回答1:


I could fix it by this:-

npm install bootstrap

Later add import 'bootstrap/dist/css/bootstrap.min.css';

Also, it is possible that we can include bootstrap.min.css cdn directly at public/index.html without installing bootstrap.



来源:https://stackoverflow.com/questions/60469800/how-to-align-left-navbar-react-bootstrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!