gpt4 book ai didi

ruby-on-rails - Bootstrap 显示移动导航栏而不是桌面

转载 作者:行者123 更新时间:2023-12-04 07:36:18 27 4
gpt4 key购买 nike

我在我的 Rails 5.1 项目中使用了 Bootstrap4,我设置了 bootstrap

gem 'bootstrap', '~> 4.0.0.beta2.1'

我按照所有说明添加了导航栏,但它看起来像移动版,但我的桌面尺寸是 1600px + 宽。

问题是什么?这是布局和导航栏

<!DOCTYPE html>
<html lang="en">
<head>
<title>CSGO</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<%= csrf_meta_tags %>

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>

<body>
<div class="container-fluid">
<%= render partial: "shared/flash" %>
<%= render 'shared/nav' %>
<%= yield %>

</div>
</body>
</html>

还有部分导航栏

<div class="row">
<div class="col-12">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<a class="navbar-brand" href="#">Hidden brand</a>
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<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>
</div>
</div>

最佳答案

您的 .navbar 需要一个额外的 .navbar-expand{-sm|-md|-lg|-xl} 类(例如:.navbar -展开-md)。 Bootstrap 文档在这里提到了这一点:http://getbootstrap.com/docs/4.0/components/navbar/#how-it-works

关于ruby-on-rails - Bootstrap 显示移动导航栏而不是桌面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47489866/

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