Dropdowns within Navs - HTML CSS Bootstrap

HTML CSS examples for Bootstrap:Dropdown

Description

Dropdowns within Navs

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Example of Bootstrap 3 Dropdowns within a Navbar</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
 </head><!--from   w ww .  j  ava2 s. c  om-->
 <body>
  <div>
   <nav id="myNavbar" class="navbar navbar-default" role="navigation">
    <div class="container">
     <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
      <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-1">
      <ul class="nav navbar-nav">
       <li><a href="#">Home</a></li>
       <li><a href="#">HTML</a></li>
       <li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">Messages <b class="caret"></b></a>
        <ul class="dropdown-menu">
         <li><a href="#">Inbox</a></li>
         <li><a href="#">Drafts</a></li>
         <li><a href="#">Sent Items</a></li>
         <li class="divider"></li>
         <li><a href="#">Trash</a></li>
        </ul> </li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
       <li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">Admin <b class="caret"></b></a>
        <ul class="dropdown-menu">
         <li><a href="#">Action</a></li>
         <li><a href="#">Another action</a></li>
         <li class="divider"></li>
         <li><a href="#">Settings</a></li>
        </ul> </li>
      </ul>
     </div>
     <!-- /.navbar-collapse -->
    </div>
   </nav>
  </div>
 </body>
</html>

Related Tutorials