我如何给bootstrap 5导航栏中的每个按钮给予间距,正如你在这里看到的,每个按钮都离它自己更近,但我不喜欢这样,所以我如何给这些按钮设置间距?
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">Navbar</a>
<div class="navbar-nav">
<a class="nav-item btn btn-primary" href="#">Home</a>
<a class="nav-item btn btn-primary" href="#">Features</a>
<a class="nav-item btn btn-primary" href="#">Pricing</a>
<a class="nav-item btn btn-primary" href="#">Disabled</a>
</div>
</div>
</nav>
1条答案
按热度按时间f45qwnt81#
将Bootstrap类
mx-lg-2 mx-0 my-lg-0 my-2
添加到所有按钮。说明:
mx-lg-2 mx-0
将在≥992px
的屏幕上添加左右边距my-lg-0 my-2
将在〈992px
的屏幕上添加上边距和下边距请参见下面的片段。