gpt4 book ai didi

twitter-bootstrap - Bootstrap 4 在容器中禁用导航栏折叠

转载 作者:行者123 更新时间:2023-12-03 15:13:09 24 4
gpt4 key购买 nike

嗨,我想在 Bootstrap 4 中禁用导航栏折叠。如果导航栏占据整个宽度,但在导航栏内,容器类只允许默认宽度放置内容,那就太好了。

我试过这个Disable responsive navbar in bootstrap 4但这不适用于其中的容器。

但这不起作用。

<nav class="navbar navbar-light bg-faded justify-content-between flex-nowrap flex-row">
<div class="container">
<a href="/" class="navbar-brand">PIM</a>
<ul class="nav navbar-nav flex-row">
<li class="nav-item"><a class="nav-link pr-3" href="">Login</a></li>
<li class="nav-item"><a class="nav-link" href="">Sign up</a></li>
</ul>
</div>
</nav>

看起来像:

enter image description here
但不应该有换行符。

如果登录在导航栏中左对齐并且注册在导航栏中右对齐,那也很好。

最佳答案

对于 bootstrap 4 beta 版本

只需添加 navbar-expand<nav>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
</nav>

关于twitter-bootstrap - Bootstrap 4 在容器中禁用导航栏折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42012446/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com