我正在使用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>
请告诉我如何使
nav collapse
出现在min-width: 768px
中? 最佳答案
http://getbootstrap.com/css/#grid-media-queries
Bootstrap媒体查询的默认值小于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) { ... }