login and registration form using HTML and CSS Source Code | AsgarTech
login and registration form using HTML and CSS. Here is an example code
Source Code Here
<!DOCTYPE html>
<html>
<head>
<title>Login and Register Form</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="form-container">
<form id="login-form">
<h2>Login</h2>
<label for="username">Username</label>
<input type="text" name="username" id="username" required>
<label for="password">Password</label>
<input type="password" name="password" id="password" required>
<button type="submit">Login</button>
</form>
<form id="register-form">
<h2>Register</h2>
<label for="fullname">Full Name</label>
<input type="text" name="fullname" id="fullname" required>
<label for="email">Email Address</label>
<input type="email" name="email" id="email" required>
<label for="new-username">Username</label>
<input type="text" name="new-username" id="new-username" required>
<label for="new-password">Password</label>
<input type="password" name="new-password" id="new-password" required>
<button type="submit">Register</button>
</form>
</div>
</body>
</html>
CSS:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #f5f5f5;
font-family: sans-serif;
}
.form-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
form {
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
padding: 20px;
width: 400px;
}
form h2 {
font-size: 24px;
margin-bottom: 20px;
text-align: center;
}
form label {
display: block;
font-size: 16px;
font-weight: bold;
margin-bottom: 5px;
}
form input[type="text"],
form input[type="email"],
form input[type="password"] {
border: none;
border-radius: 3px;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
font-size: 16px;
margin-bottom: 20px;
padding: 10px;
width: 100%;
}
form button[type="submit"] {
background-color: #4CAF50;
border: none;
border-radius: 3px;
color: #fff;
cursor: pointer;
font-size: 16px;
margin-top: 20px;
padding: 10px;
width: 100%;
}
form button[type="submit"]:hover {
background-color: #3e8e41;
}
No comments: