Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Bootstrap Navbar

Bootstrap Navbar

Introduction

With Bootstrap, you can create a static navbar. This tutorial will teach you how to do that.

We will use an HTML5 page with content and see how to add a header navbar. Here is the final output:

navbar demo

Here is the HTML5 code of the page without any content.



   

  

  

      

      Bootstrap基本的基于与标签的导航

      

      

  

  

  

  

   

To create the basic structure containing navigation, you need to insert the following code in the HTML5 code shown above, immediately after the tag:



 

Now, let's replace with the following code to create the first set of navigation. Note that the "brand" class here is rendered differently; it can be used to display your company name or organization name.





If you need to create a dropdown menu, insert the following code immediately after the HTML code shown in the last code block.





However, since Bootstrap dropdown menus require JavaScript, you need to insert the following two lines of code into your HTML page. You can insert them before the tag.







If you want to insert a search form into the navbar, simply add it right after the element containing the dropdown menu list in the