You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

183 regels
6.8 KiB

  1. <div class="bs-docs-section">
  2. <h1 id="nav" class="page-header">Navs</h1>
  3. <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>
  4. <h2 id="nav-tabs">Tabs</h2>
  5. <p>Note the <code>.nav-tabs</code> class requires the <code>.nav</code> base class.</p>
  6. <div class="bs-example">
  7. <ul class="nav nav-tabs" role="tablist">
  8. <li role="presentation" class="active"><a href="#">Home</a></li>
  9. <li role="presentation"><a href="#">Profile</a></li>
  10. <li role="presentation"><a href="#">Messages</a></li>
  11. </ul>
  12. </div>
  13. {% highlight html %}
  14. <ul class="nav nav-tabs" role="tablist">
  15. <li role="presentation" class="active"><a href="#">Home</a></li>
  16. <li role="presentation"><a href="#">Profile</a></li>
  17. <li role="presentation"><a href="#">Messages</a></li>
  18. </ul>
  19. {% endhighlight %}
  20. <div class="bs-callout bs-callout-info">
  21. <h4>Requires JavaScript tabs plugin</h4>
  22. <p>For tabs with tabbable areas, you must use the <a href="../javascript/#tabs">tabs JavaScript plugin</a>.</p>
  23. </div>
  24. <h2 id="nav-pills">Pills</h2>
  25. <p>Take that same HTML, but use <code>.nav-pills</code> instead:</p>
  26. <div class="bs-example">
  27. <ul class="nav nav-pills" role="tablist">
  28. <li role="presentation" class="active"><a href="#">Home</a></li>
  29. <li role="presentation"><a href="#">Profile</a></li>
  30. <li role="presentation"><a href="#">Messages</a></li>
  31. </ul>
  32. </div>
  33. {% highlight html %}
  34. <ul class="nav nav-pills" role="tablist">
  35. <li role="presentation" class="active"><a href="#">Home</a></li>
  36. <li role="presentation"><a href="#">Profile</a></li>
  37. <li role="presentation"><a href="#">Messages</a></li>
  38. </ul>
  39. {% endhighlight %}
  40. <p>Pills are also vertically stackable. Just add <code>.nav-stacked</code>.</p>
  41. <div class="bs-example">
  42. <ul class="nav nav-pills nav-stacked" role="tablist" style="max-width: 300px;">
  43. <li role="presentation" class="active"><a href="#">Home</a></li>
  44. <li role="presentation"><a href="#">Profile</a></li>
  45. <li role="presentation"><a href="#">Messages</a></li>
  46. </ul>
  47. </div>
  48. {% highlight html %}
  49. <ul class="nav nav-pills nav-stacked" role="tablist">
  50. ...
  51. </ul>
  52. {% endhighlight %}
  53. <h2 id="nav-justified">Justified</h2>
  54. <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>
  55. <p><strong class="text-danger">Justified navbar nav links are currently not supported.</strong></p>
  56. <div class="bs-callout bs-callout-warning">
  57. <h4>Safari and responsive justified navs</h4>
  58. <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>
  59. </div>
  60. <div class="bs-example">
  61. <ul class="nav nav-tabs nav-justified" role="tablist">
  62. <li role="presentation" class="active"><a href="#">Home</a></li>
  63. <li role="presentation"><a href="#">Profile</a></li>
  64. <li role="presentation"><a href="#">Messages</a></li>
  65. </ul>
  66. <br>
  67. <ul class="nav nav-pills nav-justified" role="tablist">
  68. <li role="presentation" class="active"><a href="#">Home</a></li>
  69. <li role="presentation"><a href="#">Profile</a></li>
  70. <li role="presentation"><a href="#">Messages</a></li>
  71. </ul>
  72. </div>
  73. {% highlight html %}
  74. <ul class="nav nav-tabs nav-justified" role="tablist">
  75. ...
  76. </ul>
  77. <ul class="nav nav-pills nav-justified" role="tablist">
  78. ...
  79. </ul>
  80. {% endhighlight %}
  81. <h2 id="nav-disabled-links">Disabled links</h2>
  82. <p>For any nav component (tabs or pills), add <code>.disabled</code> for <strong>gray links and no hover effects</strong>.</p>
  83. <div class="bs-callout bs-callout-warning">
  84. <h4>Link functionality not impacted</h4>
  85. <p>This class will only change the <code>&lt;a&gt;</code>'s appearance, not its functionality. Use custom JavaScript to disable links here.</p>
  86. </div>
  87. <div class="bs-example">
  88. <ul class="nav nav-pills" role="tablist">
  89. <li role="presentation"><a href="#">Clickable link</a></li>
  90. <li role="presentation"><a href="#">Clickable link</a></li>
  91. <li role="presentation" class="disabled"><a href="#">Disabled link</a></li>
  92. </ul>
  93. </div>
  94. {% highlight html %}
  95. <ul class="nav nav-pills" role="tablist">
  96. ...
  97. <li role="presentation" class="disabled"><a href="#">Disabled link</a></li>
  98. ...
  99. </ul>
  100. {% endhighlight %}
  101. <h2 id="nav-dropdowns">Using dropdowns</h2>
  102. <p>Add dropdown menus with a little extra HTML and the <a href="../javascript/#dropdowns">dropdowns JavaScript plugin</a>.</p>
  103. <h3>Tabs with dropdowns</h3>
  104. <div class="bs-example">
  105. <ul class="nav nav-tabs" role="tablist">
  106. <li role="presentation" class="active"><a href="#">Home</a></li>
  107. <li role="presentation"><a href="#">Help</a></li>
  108. <li role="presentation" class="dropdown">
  109. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  110. Dropdown <span class="caret"></span>
  111. </a>
  112. <ul class="dropdown-menu" role="menu">
  113. <li><a href="#">Action</a></li>
  114. <li><a href="#">Another action</a></li>
  115. <li><a href="#">Something else here</a></li>
  116. <li class="divider"></li>
  117. <li><a href="#">Separated link</a></li>
  118. </ul>
  119. </li>
  120. </ul>
  121. </div>
  122. {% highlight html %}
  123. <ul class="nav nav-tabs" role="tablist">
  124. ...
  125. <li role="presentation" class="dropdown">
  126. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  127. Dropdown <span class="caret"></span>
  128. </a>
  129. <ul class="dropdown-menu" role="menu">
  130. ...
  131. </ul>
  132. </li>
  133. ...
  134. </ul>
  135. {% endhighlight %}
  136. <h3>Pills with dropdowns</h3>
  137. <div class="bs-example">
  138. <ul class="nav nav-pills" role="tablist">
  139. <li role="presentation" class="active"><a href="#">Home</a></li>
  140. <li role="presentation"><a href="#">Help</a></li>
  141. <li role="presentation" class="dropdown">
  142. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  143. Dropdown <span class="caret"></span>
  144. </a>
  145. <ul class="dropdown-menu" role="menu">
  146. <li><a href="#">Action</a></li>
  147. <li><a href="#">Another action</a></li>
  148. <li><a href="#">Something else here</a></li>
  149. <li class="divider"></li>
  150. <li><a href="#">Separated link</a></li>
  151. </ul>
  152. </li>
  153. </ul>
  154. </div><!-- /example -->
  155. {% highlight html %}
  156. <ul class="nav nav-pills" role="tablist">
  157. ...
  158. <li role="presentation" class="dropdown">
  159. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  160. Dropdown <span class="caret"></span>
  161. </a>
  162. <ul class="dropdown-menu" role="menu">
  163. ...
  164. </ul>
  165. </li>
  166. ...
  167. </ul>
  168. {% endhighlight %}
  169. </div>