html Navbar响应式Bootstrap合理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Navbar响应式Bootstrap合理相关的知识,希望对你有一定的参考价值。

/* CSS used here will be applied after bootstrap.css */
.navbar .navbar-nav-justified {
  padding-left: 0;
  padding-right: 0;
}

.navbar .navbar-collapse > .nav-justified.nav-pills > li > a {
  padding-top: 15px;
  padding-bottom: 15px;
  margin-bottom: 0;
  -webkit-border-radius: 0;
  -moz-border-radius: 0;
  border-radius: 0;
}

.navbar .navbar-collapse > .nav-justified.nav-pills > li + li {
  margin-left: 0;
  border-top: solid 1px #e7e7e7;
}

.navbar-toggle-center {
  width: 100%;
  float: none;
  margin: 0 auto;
  border-width: 0;
  border-radius: 0;
  padding: 14px 15px;
  font-size: 16px;
}

@media (min-width: 768px) {
  .navbar .navbar-collapse > .nav-justified.nav-pills > li:first-child > a {
    -webkit-border-radius: 4px 0 0 4px;
    -moz-border-radius: 4px 0 0 4px;
    border-radius: 4px 0 0 4px;
  }

  .navbar .navbar-collapse > .nav-justified.nav-pills > li:last-child > a {
    -webkit-border-radius: 0 4px 4px 0;
    -moz-border-radius: 0 4px 4px 0;
    border-radius: 0 4px 4px 0;
  }

  .navbar .navbar-collapse > .nav-justified.nav-pills > li + li {
    margin-left: 0;
    border-left: solid 1px #e7e7e7;
    border-top: 0;
  }
}
<nav class="navbar navbar-default">
    <div>
      <div class="navbar-header" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <button type="button" class="navbar-toggle collapsed navbar-toggle-center" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="glyphicon glyphicon-menu-hamburger"></span>
          <span class="navmenu">MENU</span>
        </button>
      </div>
      <div class="collapse navbar-collapse navbar-nav-justified" id="bs-example-navbar-collapse-1">
        <ul class="nav nav-pills nav-justified">
          <li class="active"><a href="#">Home</a></li>
          <li><a href="#">Projects</a></li>
          <li><a href="#">Services</a></li>
          <li><a href="#">Downloads</a></li>
          <li><a href="#">About</a></li>
          <li><a href="#">Contact</a></li>
        </ul>
      </div>
    </div>
  </nav>

以上是关于html Navbar响应式Bootstrap合理的主要内容,如果未能解决你的问题,请参考以下文章

响应式菜单(bootstrap)

bootstrap 3 响应式巨型菜单

Html - Bootstrap 头部

bootstrap使用手记

Bootstrap 响应式菜单切换器的问题

Bootstrap Navbar仅对Android设备无响应