Are you looking for a sleek and modern way to display login options on your website? Consider creating a “Login Form with Nav Tabs” using only HTML and CSS. In this tutorial, we’ll show you step-by-step how to create a visually stunning and easy-to-use login form with navigation tabs using these two languages. You’ll learn how to use HTML to create the structure of the form and style it with CSS to give it a professional and modern appearance. Plus, you’ll gain valuable experience in using CSS to create dynamic and responsive designs. By the end of this tutorial, you’ll have a functional and visually appealing “Login Form with Nav Tabs” that you can use to enhance the user experience on your website. So, let’s get started on creating a beautiful and unique login form using HTML and CSS!
Before we start here are 50 projects to create using HTML CSS and JavaScript –
I would recommend you don’t just copy and paste the code, just look at the code and type by understanding it.
Demo
HTML Code
Starter Template
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- CSS --> <link rel="stylesheet" href="style.css"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous"> <title>Login Form with Nav Tabs using HTML and CSS - Coding Torque</title> </head> <body> <!-- Further code here --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0lpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script> </body> </html>
Paste the below code in your <body>
tag.
<div class="content"> <!-- Nav pills --> <ul class="nav nav-pills" role="tablist"> <li class="nav-item"> <a class="nav-link active" data-toggle="pill" href="#login">Login</a> </li> <li class="nav-item"> <a class="nav-link" data-toggle="pill" href="#regis">Register</a> </li> </ul> <!-- Tab panes --> <div class="tab-content"> <div id="login" class="container tab-pane active"> <form> <div class="form-group"> <label for="exampleFormControlInput1">Email address</label> <input type="email" class="form-control is-valid" id="exampleFormControlInput1" placeholder="name@example.com"> <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" class="form-control is-invalid" id="exampleInputPassword1" placeholder="Password"> <small id="emailHelp" class="form-text text-muted">Password incorrect.</small> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> <div id="regis" class="container tab-pane fade"> <form> <div class="form-group"> <label for="InputName">Full Name</label> <input type="text" class="form-control is-valid" id="InputName" placeholder="Full Name"> <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> </div> <div class="form-group"> <label for="InputUsername">Username</label> <input type="text" class="form-control is-valid" id="InputUsername" placeholder="Username"> <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> </div> <div class="form-group"> <label for="exampleFormControlInput2">Email address</label> <input type="email" class="form-control is-valid" id="exampleFormControlInput2" placeholder="name@example.com"> <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> </div> <div class="form-group"> <label for="exampleInputPassword2">Password</label> <input type="password" class="form-control is-invalid" id="exampleInputPassword2" placeholder="Password"> <small id="emailHelp" class="form-text text-muted">Password incorrect.</small> </div> <div class="form-group"> <label for="exampleInputPasswordVer">Verify Password</label> <input type="password" class="form-control is-invalid" id="exampleInputPasswordVer" placeholder="Password"> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> </div> </div>
CSS Code
Create a file style.css and paste the code below.
body { background: #16a085; } .content { width: 450px; height: auto; margin: 0 auto; padding: 30px; } .nav-pills { width: 450px; } .nav-item { width: 50%; } .nav-pills .nav-link { font-weight: bold; padding-top: 13px; text-align: center; background: #343436; color: #fff; border-radius: 30px; height: 100px; } .nav-pills .nav-link.active { background: #fff; color: #000; } .tab-content { position: absolute; width: 450px; height: auto; margin-top: -50px; background: #fff; color: #000; border-radius: 30px; z-index: 1000; box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.4); padding: 30px; margin-bottom: 50px; } .tab-content button { border-radius: 15px; width: 100px; margin: 0 auto; float: right; }
Final Output
Written by: Piyush Patil
Code Credits: @inupurnomo
If you found any mistakes or have any doubts please feel free to Contact Us
Hope you find this post helpful💖