HTML Code for Login and Password

HTML Code for Login and Password

login form,HTML form,user authentication,username,password,form validation,form submission,input fields,button,web development,web design,front-end development,user interaction,security measures,

Below is a basic example of an HTML form for login and password. Note that this form is for demonstration purposes only and lacks server-side validation and security measures.


<!DOCTYPE html>

<html lang="en">


    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Login Form</title>


        body {

            font-family: Arial, sans-serif;

            background-color: #f4f4f4;

            margin: 0;

            padding: 0;

            display: flex;

            justify-content: center;

            align-items: center;

            height: 100vh;


        form {

            max-width: 400px;

            width: 100%;

            background-color: #fff;

            padding: 20px;

            border-radius: 8px;

            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);


        label {

            display: block;

            margin-bottom: 8px;


        input {

            width: 100%;

            padding: 8px;

            margin-bottom: 16px;

            box-sizing: border-box;

            border: 1px solid #ccc;

            border-radius: 4px;


        button {

            background-color: #3498db;

            color: #fff;

            padding: 10px 15px;

            border: none;

            border-radius: 4px;

            cursor: pointer;


        button:hover {

            background-color: #2980b9;





    <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>

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




Remember to replace the `action` attribute in the `<form>` tag with the appropriate URL for processing form submissions on your server. Additionally, implement server-side validation and security measures such as password hashing to enhance security.

Post a Comment

Previous Post Next Post