Bootstrap< div class =" navbar navbar-fixed-top"> [英] Bootstrap <div class="navbar navbar-fixed-top">

查看:163
本文介绍了Bootstrap< div class =" navbar navbar-fixed-top">的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用Bootstrap构建一个网站。到目前为止一切都按计划进行。我想要一个固定的导航栏,我使用内置函数:

I am trying to built a site with Bootstrap. So far everything is going pretty much as planned. I would like a fixed navbar and I am using the built in function:

<div class="navbar navbar-fixed-top">

这是伟大的,只是我需要的,但我想导航和标题开始同一放置为容器而不是一直到左/右(仍然有导航栏的宽度100%我试图把一个容器里面的导航栏,这是不正确的解决方案:-)

This is great and just what I need BUT I would like the navigation and title to start at the same place as the container instead of all the way to the left/right (still having the navbar going 100% in width. I have tried to put a container inside the navbar which was not the correct solution :-)

推荐答案

示例



example

<div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="brand" href="./index.html">Bootstrap</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li class="active">
                <a href="./index.html">Home</a>
              </li>
              <li>
                <a href="./getting-started.html">Get started</a>
              </li>

              ...

              <li>
                <a href="./customize.html">Customize</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>

或抛出

.navbar { 
    max-width: 1170px; /* width of .container */
    margin: 0 auto;
}

加入css

这篇关于Bootstrap&lt; div class =&quot; navbar navbar-fixed-top&quot;&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆