我想将名为“登录”的项目与导航栏的右侧对齐。我该怎么做?谢谢
下面是代码:
import React from 'react'
import {Nav, Navbar, NavLink} from 'react-bootstrap'
import {Link} from 'react-router-dom'
const Navigationbar = () => {
return (
<div>
<Navbar collapseOnSelect expand="sm" bg="primary" variant="dark">
<Navbar.Toggle aria-controls='navbarScroll' data-bs-target="#navbarScroll"/>
<Navbar.Collapse id="navbarScroll">
<Nav>
<NavLink href="/">Home</NavLink>
<NavLink href="/about">About</NavLink>
<NavLink href="/contact">Contact</NavLink>
** <NavLink style={{justifyContent:"flex-end"}}>Login</NavLink>**
</Nav>
</Navbar.Collapse>
</Navbar>
</div>
)
}
export default Navigationbar
我尝试使用tyle ={{justifyContent:"flex-end "}},但不起作用。
1条答案
按热度按时间kzmpq1sx1#
将
<Nav>
设为全宽,然后将margin-left: auto
应用于链接: