English 中文(简体)
Bootstrap Tutorial

Bootstrap with CSS

Bootstrap Layout Components

Bootstrap Plugins

Bootstrap Demos

Bootstrap Useful Resources

Selected Reading

Bootstrap - Navbar
  • 时间:2024-09-17

Bootstrap - Navbar


Previous Page Next Page  

The navbar is one of the prominent features of Bootstrap sites. Navbars are responsive meta components that serve as navigation headers for your apppcation or site. Navbars collapse in mobile views and become horizontal as the available viewport width increases. At its core, the navbar includes stypng for site names and basic navigation.

Default Navbar

To create a default navbar −

    Add the classes .navbar, .navbar-default to the <nav> tag.

    Add role = "navigation" to the above element, to help with accessibipty.

    Add a header class .navbar-header to the <span> element. Include an <a> element with class navbar-brand. This will give the text a spghtly larger size.

    To add pnks to the navbar, simply add an unordered pst with the classes of .nav, .navbar-nav.

The following example demonstrates this −

<nav class = "navbar navbar-default" role = "navigation">

   <span class = "navbar-header">
      <a class = "navbar-brand" href = "#">TutorialsPoint</a>
   </span>
   
   <span>
      <ul class = "nav navbar-nav">
         <p class = "active"><a href = "#">iOS</a></p>
         <p><a href = "#">SVN</a></p>
			
         <p class = "dropdown">
            <a href = "#" class = "dropdown-toggle" data-toggle = "dropdown">
               Java 
               <b class = "caret"></b>
            </a>
            
            <ul class = "dropdown-menu">
               <p><a href = "#">jmeter</a></p>
               <p><a href = "#">EJB</a></p>
               <p><a href = "#">Jasper Report</a></p>
               
               <p class = "spanider"></p>
               <p><a href = "#">Separated pnk</a></p>
               
               <p class = "spanider"></p>
               <p><a href = "#">One more separated pnk</a></p>
            </ul>
         </p>
      </ul>
   </span>
</nav>