Header Ads Widget

How to make Login Form



How To Create an HTML LOGIN PAGE : 


Step 00: First, we will create a new folder and inside this folder we will create 3 types of files with Notepad / other kinds of code editor.
  • Open any Code Editor / Notepad / Notepad++.
  • Create a new file, if necessary.
  • Click on file - Save as - Rename file (Index) - Save as type - Hyper Text Markup Language.
  • Html file is created, now you can write your HTML code here.
  • Like you created the  HTML file, now create a CSS file.
  • Just need to change the file name (demo) - Save as type - Cascade Style Sheet (CSS).
Step 01: Open the HTML file and write the code.

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>

    <meta charset="utf-8" />
    <title>Login Form</title>

    <link rel="stylesheet" href="loginform.css" />
</head>
<body>
    <form>
        <div class="imgcontainer">
            <img src="bakracademy.png" class="avatar" />
        </div>
        <div>
            <label for="uname"><b>Username</b></label>
            <input type="text" placeholder="Enter username" name="uname" required />

            <label for="psw"><b>Password</b></label>
            <input type="password" placeholder="Enter Password" name="psw" required />
            <button type="submit"><b>Login</b></button>

            <label>
                <input type="checkbox" checked="checked" name="remember"> Remember me
            </label>

            <div class="container" style="background-color:#f1f1f1">
                <button type="button" class="cancelbtn">Cancel</button>
                <span class="psw">Forgot <a href="#">password?</a></span>
            </div>
        </div>
        
    </form>

</body>
</html>

Now save it. and open the file.

Step 02:
  • Remember you have connected this CSS file into html code inside <head> section.
  • Open the CSS file and write the code.



form {border:5px solid yellow;
      margin:10px;padding:10px;
      }

input[type=text], input[type=password] {
    width: 100%;
    padding: 12px 20px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

button {
    background-color: #04AA6D;
    color: white;
    padding: 14px 20px;
    margin: 8px 0;
    border: none;
    cursor: pointer;
    width: 100%;
}
span.psw {
    float: right;
    padding-top: 16px;
}


.cancelbtn {
    width: auto;
    padding: 10px 18px;
    background-color: #f44336;
}


@media screen and (max-width: 300px) {
    span.psw {
        display: block;
        float: none;
    }

    .cancelbtn {
        width: 100%;
    }
}

/* Center the avatar image inside this container */
.imgcontainer {
    text-align: center;
    margin: 24px 0 12px 0;
}

/* Avatar image */
img.avatar {
    width: 100%;
    height:400px;
    border-radius: 10%;
    
}