HTML CSS examples for Bootstrap:Navbar
Adds a dropdown menu with a login form in the navbar:
<!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <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/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head><!-- w w w . j ava2 s . c o m--> <body> <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#">WebSiteName</a> </div> <div> <ul class="nav navbar-nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Page 1</a></li> <li><a href="#">Page 2</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Login <span class="glyphicon glyphicon-log-in"></span></a> <div class="dropdown-menu"> <form id="formLogin" class="form container-fluid"> <div class="form-group"> <label for="usr">Name:</label> <input type="text" class="form-control" id="usr"> </div> <div class="form-group"> <label for="pwd">Password:</label> <input type="password" class="form-control" id="pwd"> </div> <button type="button" id="btnLogin" class="btn btn-block">Login</button> </form> <div class="container-fluid"> <br> <a class="small" href="#">Forgot password?</a> </div> </div> </li> </ul> </div> </div> </nav> <div class="container"> <h3>Navbar With Dropdown</h3> <p>This example adds a dropdown menu for the "Login" button in the navigation bar.</p> </div> </body> </html>