Bootstrap 3折叠导航栏

时间:2015-12-08 13:59:51

标签: html css twitter-bootstrap

我的bootstrap 3导航栏出了问题,这在我的任何其他项目中从未发生过。

图片:

enter image description here

当导航栏折叠时,它没有打开到窗口的整个宽度,它只打开到屏幕中间的某个宽度,有人可以帮我解决这个问题吗?

代码:(我使用SASS代替css)

.navbar {
  border: none;
  border-radius: 0;
  margin-right: 25px;
  background-color: transparent;
  border-color: transparent;
  -webkit-transition: all 0.6s ease-out;
  -moz-transition: all 0.6s ease-out;
  -o-transition: all 0.6s ease-out;
  -ms-transition: all 0.6s ease-out;
  transition: all 0.6s ease-out;
}
.navbar .scrolled {
  background: white;
  background: white;
}
.navbar-nav li a {
  color: #fff;
  border: 3px solid transparent;
  border-radius: 0px;
  transition: background 0.5s;
  margin-top: 10px;
  padding-top: 5px;
  padding-bottom: 5px;
}
.navbar-default .navbar-nav li a {
  color: #fff;
  border: 3px solid transparent;
  border-radius: 0px;
  transition: background 0.5s;
  margin-top: 10px;
  padding-top: 5px;
  padding-bottom: 5px;
}
.navbar-default .navbar-nav li a:hover {
  text-decoration: none;
  color: #fff;
  border: 3px solid white;
  border-radius: 0px;
  background-color: transparent;
  background: transparent;
}
.navbar-default .navbar-nav .active a {
  text-decoration: none;
  border: 3px solid white;
  border-radius: 0px;
  color: #fff;
  background-color: transparent;
  background: transparent;
}
.navbar-default .navbar-nav .active a:hover {
  background-color: transparent;
  color: #fff;
}
.navbar-toggle {
  position: relative;
  float: right;
  padding: 9px 10px;
  margin-top: 8px;
  margin-right: 15px;
  margin-bottom: 8px;
  background-color: transparent;
  background-image: none;
  border: 1px solid #fff;
  border-radius: 4px;
}
.navbar-toggle .icon-bar {
  display: block;
  width: 22px;
  height: 2px;
  color: #fff;
  border-radius: 1px;
  border: 1px solid #fff;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
  <div class="container-fluid">
    <div lass="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <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 page-scroll" href="#page-top">
        <img src="assets/img/logo.png" alt="logo">
      </a>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#">About us</a> 
        </li>
        <li><a href="#">Our venues</a>
        </li>
        <li><a href="#">Spaces &amp; Services</a>
        </li>
        <li><a href="#">News &amp; events</a>
        </li>
        <li class="active"><a href="#">Give us a shout</a>
        </li>
      </ul>
    </div>
  </div>
</nav>

0 个答案:

没有答案