Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Bootstrap Navbar with Inline Login Form in Dropdown</title> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,600"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> <style> body { font-family: 'Open Sans', sans-serif; } .form-control { box-shadow: none; border-radius: 4px; border-color: #dfe3e8; } .navbar { background: #fff; padding-left: 16px; padding-right: 16px; border-bottom: 1px solid #dfe3e8; border-radius: 0; } .navbar .navbar-brand { font-size: 20px; padding-left: 0; padding-right: 50px; } .navbar .navbar-brand b { color: #29c68c; } .navbar a, .navbar a:active { color: #999; background: transparent; } .navbar .navbar-nav a:hover, .navbar .navbar-nav a:focus { color: #29c68c !important; } .navbar .navbar-nav > a.active, .navbar .navbar-nav.show > a { color: #26bb84 !important; background: transparent !important; } .navbar .form-inline .input-group-text { box-shadow: none; border-radius: 2px 0 0 2px; background: #f5f5f5; border-color: #dfe3e8; font-size: 16px; } .navbar .form-inline i { font-size: 16px; } .navbar .form-inline .btn { border-radius: 2px; color: #fff; border-color: #29c68c; background: #29c68c; outline: none; } .navbar .form-inline .btn:hover, .navbar .form-inline .btn:focus { border-color: #26bb84; background: #26bb84; } .navbar .search-form { display: inline-block; } .navbar .search-form .btn { margin-left: 4px; } .navbar .search-form .form-control { border-radius: 2px; } .navbar .login-form .input-group { margin-right: 4px; float: left; } .navbar .login-form .form-control { max-width: 158px; border-radius: 0 2px 2px 0; } .navbar .navbar-right .dropdown-toggle::after { display: none; } .navbar .dropdown-menu { font-size: 14px; border-radius: 1px; border-color: #e5e5e5; box-shadow: 0 2px 8px rgba(0,0,0,.05); } .navbar .dropdown-menu a { padding: 6px 20px; } .navbar .login-dropdown .dropdown-menu { width: 505px; padding: 20px; left: auto; right: 0; } .navbar .login-dropdown .dropdown-toggle::after { display: none; } @media (min-width: 1200px){ .search-form .input-group { width: 300px; margin-left: 30px; } } @media (max-width: 768px){ .navbar .dropdown-menu { width: 100%; background: transparent; padding: 10px 20px; } .navbar .input-group { width: 100%; margin-bottom: 15px; } .navbar .input-group .form-control { max-width: none; } .navbar .login-form .btn { width: 100%; } } </style> </head> <body> <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a href="#" class="navbar-brand">Brand<b>Name</b></a> <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse"> <span class="navbar-toggler-icon"></span> </button> <!-- Collection of nav links, forms, and other content for toggling --> <div id="navbarCollapse" class="collapse navbar-collapse justify-content-start"> <div class="navbar-nav"> <a href="#" class="nav-item nav-link">Home</a> <a href="#" class="nav-item nav-link">About</a> <div class="nav-item dropdown"> <a href="#" data-toggle="dropdown" class="nav-item nav-link dropdown-toggle">Services</a> <div class="dropdown-menu"> <a href="#" class="dropdown-item">Web Design</a> <a href="#" class="dropdown-item">Web Development</a> <a href="#" class="dropdown-item">Graphic Design</a> <a href="#" class="dropdown-item">Digital Marketing</a> </div> </div> <a href="#" class="nav-item nav-link active">Pricing</a> <a href="#" class="nav-item nav-link">Blog</a> <a href="#" class="nav-item nav-link">Contact</a> </div> <form class="navbar-form form-inline search-form"> <div class="input-group"> <input type="text" class="form-control" placeholder="Search..."> <span class="input-group-btn"> <button type="button" class="btn btn-default"><i class="fa fa-search"></i></button> </span> </div> </form> <div class="navbar-nav ml-auto"> <div class="nav-item dropdown login-dropdown"> <a href="#" data-toggle="dropdown" class="nav-item nav-link dropdown-toggle"><i class="fa fa-user-o"></i> Login</a> <div class="dropdown-menu"> <form class="form-inline login-form" action="/examples/actions/confirmation.php" method="post"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text"> <span class="fa fa-user"></span> </span> </div> <input type="text" class="form-control" placeholder="Username" required> </div> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text"> <i class="fa fa-lock"></i> </span> </div> <input type="text" class="form-control" placeholder="Password" required> </div> <button type="submit" class="btn btn-primary">Login</button> </form> </div> </div> </div> </div> </nav> </body> </html>