top of page
Writer's picturecompnomics

Login and Password Recovery Form (HTML & CSS)


 

Login Form Code for Login . html file


HTML:

<!DOCTYPE html>

<html lang="en">

<head>

  <title>Login Form</title>

  <link rel="stylesheet" href="style.css">

</head>

<body>

  <div class="container">

    <h1>Login</h1>

    <form action="#" method="post">

      <label for="username">Username:</label>

      <input type="text" id="username" name="username" required>

      <label for="password">Password:</label>

      <input type="password" id="password" name="password" required>

      <a href="recover.html">Forgot Password?</a>

      <button type="submit">Login</button>

    </form>

  </div>

</body>

</html>


Login Form CSS , include in head tag in <style></style> tag:

body {

  font-family: sans-serif;

  display: flex;

  justify-content: center;

  align-items: center;

  min-height: 100vh;

}


.container {

  background-color: #f2f2f2;

  padding: 30px;

  border-radius: 5px;

  width: 300px;

}


h1 {

  text-align: center;

  margin-bottom: 20px;

}


label {

  display: block;

  margin-bottom: 5px;

}


input[type="text"],

input[type="password"],

input[type="email"]

 {

  width: 100%;

  padding: 10px;

  border: 1px solid #ccc;

  border-radius: 3px;

  margin-bottom: 15px;

}


a {

  color: #333;

  text-decoration: none;

  margin-top: 5px;

  display: block;

}


a:hover {

  color: #007bff;

}


button {

  background-color: #007bff;

  color: white;

  padding: 10px 20px;

  border: none;

  border-radius: 3px;

  cursor: pointer;

}


button:hover {

  background-color: #0062cc;

}


Password Recovery Page: recover . html file

HTML:

HTML

<!DOCTYPE html>

<html lang="en">

<head>

  <title>Recover Password</title>

  <link rel="stylesheet" href="style.css">

</head>

<body>

  <div class="container">

    <h1>Recover Password</h1>

    <form action="#" method="post">

      <label for="username">Username:</label>

      <input type="text" id="username" name="username" required>

      <label for="email">Email:</label>

      <input type="email" id="email" name="email" required>

      <button type="submit">Send Recovery Link</button>

    </form>

  </div>

</body>

</html>


CSS: (Same as login page)

Note:

  • This is a basic example and doesn't handle actual login or password recovery functionality.

  • Remember that storing passwords in plain text is insecure. For real-world applications, use secure password hashing techniques.

  • Consider accessibility best practices when designing login forms.





22 views0 comments

Recent Posts

See All

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page