我正在使用Bootstrap v3.3.6
和jQuery v2.1.1
。
我想问为什么我的navbar
没有在nav collapse
的决议中转到sm
?
在width: 768px
分辨率下,nav collapse
出现。但在width: 768px
,它没有。
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
<img src="img/logo.png">
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="people.html">People</a>
</li>
<li class="active"><a href="index.html">Gallery</a>
</li>
<li><a href="inspiration.html">Inspiration</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="listJob.html">Jobs oportunity</a>
</li>
<li><a href="">hirring a chief?</a>
</li>
<li><a href="signUp.html">login|signup</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
&#13;
请告诉我如何让nav collapse
显示在min-width: 768px
?
答案 0 :(得分:1)
http://getbootstrap.com/css/#grid-media-queries
Bootstrap Media Query默认为少于768px(不包括)
/* Extra small devices (phones, less than 768px) */
/* No media query since this is the default in Bootstrap */
这就是为什么它的工作频率低于768px而不包括。
sm
媒体查询包括768px及以上。
/* Small devices (tablets, 768px and up) */
@media (min-width: @screen-sm-min) { ... }
您可以添加自己的媒体查询以包含768px
@media screen and (max-width: 768px) { ... }