How To Code Login Page In Html

HTML Programming

Creating a login page in HTML is an essential skill for any web developer. In this article, I will guide you through the process of coding a login page in HTML, step by step. I will also share some personal tips and tricks along the way to help you add your own personal touch to your login page.

The HTML Form

To start, we need to create an HTML form to collect the user’s login credentials. We can use the <form> tag along with the <input> tag to create input fields for the username and password.

  <label for="username">Username:</label>
  <input type="text" id="username" name="username">
  <label for="password">Password:</label>
  <input type="password" id="password" name="password">
  <input type="submit" value="Login">

Add Personal Touch

Now, let’s add our personal touch to the login page. One way to do this is by adding customized CSS styles. We can use the <style> tag within the <head> section of our HTML document to define our own styles.

  body {
    background-color: #f2f2f2;
  form {
    width: 300px;
    margin: 0 auto;
    padding: 20px;
    background-color: #ffffff;
    border: 1px solid #dddddd;
  input[type="text"], input[type="password"], input[type="submit"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #dddddd;
  input[type="submit"] {
    background-color: #4CAF50;
    color: #ffffff;
    font-weight: bold;
    cursor: pointer;

Linking to the Login Page

Once you have coded your login page, it’s important to provide a link to it so that users can access it. You can use the <a> tag to create a hyperlink to your login page.

<a href="login.html">Click here to login</a>


In this article, we have covered the process of coding a login page in HTML. By following these steps and adding your personal touch, you can create a stylish and functional login page for your website. Remember to test your login page thoroughly and ensure that it provides a secure and user-friendly experience for your website visitors.