2014-03-17 03:03:53 +01:00
< div class = "bs-docs-section" >
< h1 id = "nav" class = "page-header" > Navs< / h1 >
< p class = "lead" > Navs available in Bootstrap have shared markup, starting with the base < code > .nav< / code > class, as well as shared states. Swap modifier classes to switch between each style.< / p >
2014-11-12 05:23:49 +01:00
< div class = "bs-callout bs-callout-info" id = "callout-navs-tabs-plugin" >
2014-10-30 17:45:33 +01:00
< h4 > Using navs for tab panels requires JavaScript tabs plugin< / h4 >
< p > For tabs with tabbable areas, you must use the < a href = "../javascript/#tabs" > tabs JavaScript plugin< / a > . The markup will also require additional < code > role< / code > and ARIA attributes – see the plugin's < a href = "../javascript/#tabs-usage" > example markup< / a > for further details.< / p >
< / div >
2014-11-12 05:23:49 +01:00
< div class = "bs-callout bs-callout-warning" id = "callout-navs-accessibility" >
2014-10-30 17:45:33 +01:00
< h4 > Make navs used as navigation accessible< / h4 >
< p > If you are using navs to provide a navigation bar, be sure to add a < code > role="navigation"< / code > to the most logical parent container of the < code > < ul> < / code > , or wrap a < code > < nav> < / code > element around the whole navigation. Do not add the role to the < code > < ul> < / code > itself, as this would prevent it from being announced as an actual list by assistive technologies.< / p >
< / div >
2014-03-17 03:03:53 +01:00
< h2 id = "nav-tabs" > Tabs< / h2 >
< p > Note the < code > .nav-tabs< / code > class requires the < code > .nav< / code > base class.< / p >
2014-11-25 02:09:32 +01:00
< div class = "bs-example" data-example-id = "simple-nav-tabs" >
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-tabs" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Profile< / a > < / li >
< li role = "presentation" > < a href = "#" > Messages< / a > < / li >
2014-03-17 03:03:53 +01:00
< / ul >
< / div >
{% highlight html %}
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-tabs" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Profile< / a > < / li >
< li role = "presentation" > < a href = "#" > Messages< / a > < / li >
2014-03-17 03:03:53 +01:00
< / ul >
{% endhighlight %}
2014-10-30 17:45:33 +01:00
2014-03-17 03:03:53 +01:00
< h2 id = "nav-pills" > Pills< / h2 >
< p > Take that same HTML, but use < code > .nav-pills< / code > instead:< / p >
2014-11-25 02:09:32 +01:00
< div class = "bs-example" data-example-id = "simple-nav-pills" >
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Profile< / a > < / li >
< li role = "presentation" > < a href = "#" > Messages< / a > < / li >
2014-03-17 03:03:53 +01:00
< / ul >
< / div >
{% highlight html %}
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Profile< / a > < / li >
< li role = "presentation" > < a href = "#" > Messages< / a > < / li >
2014-03-17 03:03:53 +01:00
< / ul >
{% endhighlight %}
< p > Pills are also vertically stackable. Just add < code > .nav-stacked< / code > .< / p >
2014-11-25 02:09:32 +01:00
< div class = "bs-example" data-example-id = "simple-nav-stacked" >
2014-11-20 09:09:47 +01:00
< ul class = "nav nav-pills nav-stacked nav-pills-stacked-example" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Profile< / a > < / li >
< li role = "presentation" > < a href = "#" > Messages< / a > < / li >
2014-03-17 03:03:53 +01:00
< / ul >
< / div >
{% highlight html %}
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills nav-stacked" >
2014-03-17 03:03:53 +01:00
...
< / ul >
{% endhighlight %}
< h2 id = "nav-justified" > Justified< / h2 >
< p > Easily make tabs or pills equal widths of their parent at screens wider than 768px with < code > .nav-justified< / code > . On smaller screens, the nav links are stacked.< / p >
2014-09-24 03:06:39 +02:00
< p > < strong class = "text-danger" > Justified navbar nav links are currently not supported.< / strong > < / p >
2014-11-12 05:23:49 +01:00
< div class = "bs-callout bs-callout-warning" id = "callout-navs-justified-safari" >
2014-03-17 03:03:53 +01:00
< h4 > Safari and responsive justified navs< / h4 >
2014-10-29 05:24:45 +01:00
< p > As of v8.0, Safari exhibits a bug in which resizing your browser horizontally causes rendering errors in the justified nav that are cleared upon refreshing. This bug is also shown in the < a href = "../examples/justified-nav/" > justified nav example< / a > .< / p >
2014-03-17 03:03:53 +01:00
< / div >
2014-11-25 02:09:32 +01:00
< div class = "bs-example" data-example-id = "simple-nav-justified" >
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-tabs nav-justified" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Profile< / a > < / li >
< li role = "presentation" > < a href = "#" > Messages< / a > < / li >
2014-03-17 03:03:53 +01:00
< / ul >
< br >
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills nav-justified" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Profile< / a > < / li >
< li role = "presentation" > < a href = "#" > Messages< / a > < / li >
2014-03-17 03:03:53 +01:00
< / ul >
< / div >
{% highlight html %}
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-tabs nav-justified" >
2014-03-17 03:03:53 +01:00
...
< / ul >
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills nav-justified" >
2014-03-17 03:03:53 +01:00
...
< / ul >
{% endhighlight %}
< h2 id = "nav-disabled-links" > Disabled links< / h2 >
< p > For any nav component (tabs or pills), add < code > .disabled< / code > for < strong > gray links and no hover effects< / strong > .< / p >
2014-11-12 05:23:49 +01:00
< div class = "bs-callout bs-callout-warning" id = "callout-navs-anchor-disabled" >
2014-03-17 03:03:53 +01:00
< h4 > Link functionality not impacted< / h4 >
< p > This class will only change the < code > < a> < / code > 's appearance, not its functionality. Use custom JavaScript to disable links here.< / p >
< / div >
2014-11-25 02:09:32 +01:00
< div class = "bs-example" data-example-id = "disabled-nav-link" >
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" > < a href = "#" > Clickable link< / a > < / li >
< li role = "presentation" > < a href = "#" > Clickable link< / a > < / li >
< li role = "presentation" class = "disabled" > < a href = "#" > Disabled link< / a > < / li >
2014-03-17 03:03:53 +01:00
< / ul >
< / div >
{% highlight html %}
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills" >
2014-03-17 03:03:53 +01:00
...
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "disabled" > < a href = "#" > Disabled link< / a > < / li >
2014-03-17 03:03:53 +01:00
...
< / ul >
{% endhighlight %}
< h2 id = "nav-dropdowns" > Using dropdowns< / h2 >
< p > Add dropdown menus with a little extra HTML and the < a href = "../javascript/#dropdowns" > dropdowns JavaScript plugin< / a > .< / p >
< h3 > Tabs with dropdowns< / h3 >
2014-11-25 02:09:32 +01:00
< div class = "bs-example" data-example-id = "nav-tabs-with-dropdown" >
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-tabs" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Help< / a > < / li >
< li role = "presentation" class = "dropdown" >
2015-06-02 10:41:40 +02:00
< a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" role = "button" aria-haspopup = "true" aria-expanded = "false" >
2014-03-17 03:03:53 +01:00
Dropdown < span class = "caret" > < / span >
< / a >
2015-06-02 10:41:40 +02:00
< ul class = "dropdown-menu" >
2014-03-17 03:03:53 +01:00
< li > < a href = "#" > Action< / a > < / li >
< li > < a href = "#" > Another action< / a > < / li >
< li > < a href = "#" > Something else here< / a > < / li >
2015-05-30 00:48:35 +02:00
< li role = "separator" class = "divider" > < / li >
2014-03-17 03:03:53 +01:00
< li > < a href = "#" > Separated link< / a > < / li >
< / ul >
< / li >
< / ul >
< / div >
{% highlight html %}
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-tabs" >
2014-03-17 03:03:53 +01:00
...
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "dropdown" >
2015-06-02 10:41:40 +02:00
< a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" role = "button" aria-haspopup = "true" aria-expanded = "false" >
2014-03-17 03:03:53 +01:00
Dropdown < span class = "caret" > < / span >
< / a >
2015-06-02 10:41:40 +02:00
< ul class = "dropdown-menu" >
2014-03-17 03:03:53 +01:00
...
< / ul >
< / li >
...
< / ul >
{% endhighlight %}
< h3 > Pills with dropdowns< / h3 >
2014-11-25 02:09:32 +01:00
< div class = "bs-example" data-example-id = "nav-pills-with-dropdown" >
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills" >
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "active" > < a href = "#" > Home< / a > < / li >
< li role = "presentation" > < a href = "#" > Help< / a > < / li >
< li role = "presentation" class = "dropdown" >
2015-06-02 10:41:40 +02:00
< a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" role = "button" aria-haspopup = "true" aria-expanded = "false" >
2014-03-17 03:03:53 +01:00
Dropdown < span class = "caret" > < / span >
< / a >
2015-06-02 10:41:40 +02:00
< ul class = "dropdown-menu" >
2014-03-17 03:03:53 +01:00
< li > < a href = "#" > Action< / a > < / li >
< li > < a href = "#" > Another action< / a > < / li >
< li > < a href = "#" > Something else here< / a > < / li >
2015-05-30 00:48:35 +02:00
< li role = "separator" class = "divider" > < / li >
2014-03-17 03:03:53 +01:00
< li > < a href = "#" > Separated link< / a > < / li >
< / ul >
< / li >
< / ul >
< / div > <!-- /example -->
{% highlight html %}
2014-10-30 17:45:33 +01:00
< ul class = "nav nav-pills" >
2014-03-17 03:03:53 +01:00
...
2014-07-08 20:58:33 +02:00
< li role = "presentation" class = "dropdown" >
2015-06-02 10:41:40 +02:00
< a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" role = "button" aria-haspopup = "true" aria-expanded = "false" >
2014-03-17 03:03:53 +01:00
Dropdown < span class = "caret" > < / span >
< / a >
2015-06-02 10:41:40 +02:00
< ul class = "dropdown-menu" >
2014-03-17 03:03:53 +01:00
...
< / ul >
< / li >
...
< / ul >
{% endhighlight %}
< / div >