gpt4 book ai didi

html - Bootstrap 4 - 响应式水平导航

转载 作者:行者123 更新时间:2023-11-28 01:01:54 25 4
gpt4 key购买 nike

我遇到了 Bootstrap 4 导航的问题,如果导航链接的容器宽度太小,导航链接就会悬垂。移动设备通常就是这种情况。

这是一个例子:http://codepen.io/anon/pen/ZLKGrx

<div class="container">
<div class="row">
<div class="col-6 offset-3 columnbg">
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link active" href="#">LongTabName</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">LongTabName</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">LongTabName</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">LongTabName</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">LongTabName</a>
</li>
</ul>
</div>
</div>
</div>

我想实现适合较小显示器的东西。我该怎么做?

最佳答案

Bootstrap 专为移动优先而构建。您遇到此问题的唯一原因是您没有完全实现 navbar :

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>

<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<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="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>

关于html - Bootstrap 4 - 响应式水平导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41778822/

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