17/08/2026
Login & Registration form Code
Login & Registration
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: ;
}
.container {
width: 800px;
max-width: 95%;
min-height: 450px;
background: white;
border-radius: 18px;
box-shadow: 0 10px 35px rgba(0, 0, 0, 0.12);
overflow: hidden;
display: flex;
}
.welcome {
width: 45%;
background: linear-gradient(135deg, , );
color: white;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 30px;
}
.welcome h1 {
font-size: 28px;
margin-bottom: 10px;
}
.welcome p {
font-size: 14px;
margin-bottom: 25px;
opacity: 0.9;
}
.welcome button {
background: transparent;
border: 1px solid white;
color: white;
padding: 10px 28px;
border-radius: 6px;
cursor: pointer;
transition: 0.3s;
}
.welcome button:hover {
background: white;
color: ;
}
.form-section {
width: 55%;
padding: 40px;
display: flex;
flex-direction: column;
justify-content: center;
}
.form-section h2 {
text-align: center;
margin-bottom: 25px;
color: #333;
}
.input-box {
margin-bottom: 15px;
}
.input-box input {
width: 100%;
padding: 13px;
border: 1px solid ;
border-radius: 5px;
outline: none;
font-size: 14px;
}
.input-box input:focus {
border-color: ;
}
.submit-btn {
width: 100%;
padding: 13px;
border: none;
background: ;
color: white;
border-radius: 5px;
cursor: pointer;
font-size: 15px;
margin-top: 5px;
}
.submit-btn:hover {
background: ;
}
.switch-text {
text-align: center;
margin-top: 18px;
font-size: 13px;
color: #777;
}
.switch-text a {
color: ;
cursor: pointer;
text-decoration: none;
font-weight: bold;
}
/* Registration hidden initially */
{
display: none;
}
(max-width: 650px) {
.container {
flex-direction: column;
}
.welcome,
.form-section {
width: 100%;
}
.welcome {
min-height: 180px;
}
.form-section {
padding: 30px 25px;
}
}
Hello, Welcome!
Don't have an account?
Register
Login
Login
Don't have an account?
Register
Registration
Register
Already have an account?
Login
const loginForm = document.getElementById("loginForm");
const registerForm = document.getElementById("registerForm");
const welcomeTitle = document.getElementById("welcomeTitle");
const welcomeText = document.getElementById("welcomeText");
const welcomeButton = document.getElementById("welcomeButton");
function showRegister() {
loginForm.style.display = "none";
registerForm.style.display = "flex";
welcomeTitle.textContent = "Welcome Back!";
welcomeText.textContent = "Already have an account?";
welcomeButton.textContent = "Login";
welcomeButton.onclick = showLogin;
}
function showLogin() {
registerForm.style.display = "none";
loginForm.style.display = "flex";
welcomeTitle.textContent = "Hello, Welcome!";
welcomeText.textContent = "Don't have an account?";
welcomeButton.textContent = "Register";
welcomeButton.onclick = showRegister;
}