๐Ÿ“‹ Details

  • Title: The <title> tag sets the page title shown in the browser tab. Inside the form, an <h2> heading displays "Login" at the top of the box.
  • Form Structure: The <form> element wraps the input fields and button.
  • Inputs:
    • type="text" โ†’ for the username field.
    • type="password" โ†’ hides characters for the password field.
    • Both have required so the user must fill them before submitting.
  • Button: A <button type="submit"> sends the form data when clicked.
  • Styling: CSS centers the form, adds padding, rounded corners, and hover effects for a modern look.
  • Responsiveness: The meta viewport tag ensures it looks good on mobile devices.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Login Form</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background: #f4f4f4;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
    }
    .login-box {
      background: #fff;
      padding: 30px;
      border-radius: 8px;
      box-shadow: 0 0 10px rgba(0,0,0,0.1);
      width: 300px;
    }
    .login-box h2 {
      text-align: center;
      margin-bottom: 20px;
    }
    .login-box input[type="text"],
    .login-box input[type="password"] {
      width: 100%;
      padding: 10px;
      margin: 8px 0;
      border: 1px solid #ccc;
      border-radius: 5px;
    }
    .login-box button {
      width: 100%;
      padding: 10px;
      background: #007BFF;
      color: #fff;
      border: none;
      border-radius: 5px;
      cursor: pointer;
    }
    .login-box button:hover {
      background: #0056b3;
    }
  </style>
</head>
<body>
  <div class="login-box">
    <h2>Login</h2>
    <form>
      <input type="text" placeholder="Username" required>
      <input type="password" placeholder="Password" required>
      <button type="submit">Login</button>
    </form>
  </div>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *