0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-18 10:52:19 +01:00

Fixes #11783: Document requirement of .container(-fluid) in navbars

This commit is contained in:
Mark Otto 2013-12-15 13:44:26 -08:00
parent 540677c42a
commit 93a4d6cc5e

View File

@ -2295,33 +2295,36 @@ base_url: "../"
<h2 id="navbar-fixed-top">Fixed to top</h2> <h2 id="navbar-fixed-top">Fixed to top</h2>
<p>Add <code>.navbar-fixed-top</code>.</p> <p>Add <code>.navbar-fixed-top</code> and include a <code>.container</code> or <code>.container-fluid</code> to center and pad navbar content.</p>
<div class="bs-example bs-navbar-top-example"> <div class="bs-example bs-navbar-top-example">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display --> <!-- We use the fluid option here to avoid overriding the fixed width of a normal container within the narrow content columns. -->
<div class="navbar-header"> <div class="container-fluid">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-6"> <div class="navbar-header">
<span class="sr-only">Toggle navigation</span> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-6">
<span class="icon-bar"></span> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> <span class="icon-bar"></span>
<a class="navbar-brand" href="#">Brand</a> </button>
</div> <a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-6">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-6"> <ul class="nav navbar-nav">
<ul class="nav navbar-nav"> <li class="active"><a href="#">Home</a></li>
<li class="active"><a href="#">Home</a></li> <li><a href="#">Link</a></li>
<li><a href="#">Link</a></li> <li><a href="#">Link</a></li>
<li><a href="#">Link</a></li> </ul>
</ul> </div><!-- /.navbar-collapse -->
</div><!-- /.navbar-collapse --> </div>
</nav> </nav>
</div><!-- /example --> </div><!-- /example -->
{% highlight html %} {% highlight html %}
<nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
... <div class="container">
...
</div>
</nav> </nav>
{% endhighlight %} {% endhighlight %}
@ -2336,33 +2339,36 @@ body { padding-top: 70px; }
<h2 id="navbar-fixed-bottom">Fixed to bottom</h2> <h2 id="navbar-fixed-bottom">Fixed to bottom</h2>
<p>Add <code>.navbar-fixed-bottom</code> instead.</p> <p>Add <code>.navbar-fixed-bottom</code> and include a <code>.container</code> or <code>.container-fluid</code> to center and pad navbar content.</p>
<div class="bs-example bs-navbar-bottom-example"> <div class="bs-example bs-navbar-bottom-example">
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation"> <nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<!-- Brand and toggle get grouped for better mobile display --> <!-- We use the fluid option here to avoid overriding the fixed width of a normal container within the narrow content columns. -->
<div class="navbar-header"> <div class="container-fluid">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-7"> <div class="navbar-header">
<span class="sr-only">Toggle navigation</span> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-7">
<span class="icon-bar"></span> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> <span class="icon-bar"></span>
<a class="navbar-brand" href="#">Brand</a> </button>
</div> <a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-7">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-7"> <ul class="nav navbar-nav">
<ul class="nav navbar-nav"> <li class="active"><a href="#">Home</a></li>
<li class="active"><a href="#">Home</a></li> <li><a href="#">Link</a></li>
<li><a href="#">Link</a></li> <li><a href="#">Link</a></li>
<li><a href="#">Link</a></li> </ul>
</ul> </div><!-- /.navbar-collapse -->
</div><!-- /.navbar-collapse --> </div>
</nav> </nav>
</div><!-- /example --> </div><!-- /example -->
{% highlight html %} {% highlight html %}
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation"> <nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
... <div class="container">
...
</div>
</nav> </nav>
{% endhighlight %} {% endhighlight %}
@ -2377,33 +2383,38 @@ body { padding-bottom: 70px; }
<h2 id="navbar-static-top">Static top</h2> <h2 id="navbar-static-top">Static top</h2>
<p>Create a full-width navbar that scrolls away with the page by adding <code>.navbar-static-top</code>. Unlike the <code>.navbar-fixed-*</code> classes, you do not need to change any padding on the <code>body</code>.</p> <p>Create a full-width navbar that scrolls away with the page by adding <code>.navbar-static-top</code> and include a <code>.container</code> or <code>.container-fluid</code> to center and pad navbar content.</p>
<p>Unlike the <code>.navbar-fixed-*</code> classes, you do not need to change any padding on the <code>body</code>.</p>
<div class="bs-example bs-navbar-top-example"> <div class="bs-example bs-navbar-top-example">
<nav class="navbar navbar-default navbar-static-top" role="navigation"> <nav class="navbar navbar-default navbar-static-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display --> <!-- We use the fluid option here to avoid overriding the fixed width of a normal container within the narrow content columns. -->
<div class="navbar-header"> <div class="container-fluid">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-8"> <div class="navbar-header">
<span class="sr-only">Toggle navigation</span> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-8">
<span class="icon-bar"></span> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> <span class="icon-bar"></span>
<a class="navbar-brand" href="#">Brand</a> </button>
</div> <a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling --> <!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-8"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-8">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li> <li class="active"><a href="#">Home</a></li>
<li><a href="#">Link</a></li> <li><a href="#">Link</a></li>
<li><a href="#">Link</a></li> <li><a href="#">Link</a></li>
</ul> </ul>
</div><!-- /.navbar-collapse --> </div><!-- /.navbar-collapse -->
</div>
</nav> </nav>
</div><!-- /example --> </div><!-- /example -->
{% highlight html %} {% highlight html %}
<nav class="navbar navbar-default navbar-static-top" role="navigation"> <nav class="navbar navbar-default navbar-static-top" role="navigation">
... <div class="container">
...
</div>
</nav> </nav>
{% endhighlight %} {% endhighlight %}