Login Form
February 15, 2025
5 min read

How to Create an Ultra-Modern Login Page with HTML, CSS, and JavaScript

How to Create an Ultra-Modern Login Page with HTML, CSS, and JavaScript

A well-designed login page is crucial for any website or web app. It’s the first interaction users have, and a sleek, modern login experience can leave a lasting impression. In this tutorial, we will walk you through creating an ultra-modern login page using HTML, CSS, and JavaScript. This login page features smooth animations, a stylish UI, and a user-friendly interface to enhance the user experience.

Why You Need a Modern Login Page

A basic login page might get the job done, but a visually appealing and highly functional design adds professionalism and improves usability. A modern login page ensures:

  • Better User Engagement: A stylish interface makes logging in an enjoyable experience.
  • Improved Security: Features like password visibility toggles and secure form fields enhance security.
  • Responsive Design: Works smoothly on desktops, tablets, and mobile devices.
  • Seamless Interaction: Animated transitions and smooth UI elements create a seamless experience.

Key Features of the Ultra-Modern Login Page

Our login page includes several cutting-edge features to improve usability and aesthetics:

1. Stylish UI with Gradient Backgrounds

A visually stunning login page includes gradient backgrounds, subtle animations, and a sleek font to make the design stand out.

2. Smooth Animations and Transitions

Adding fade-in effects and interactive elements makes the login process more engaging and fluid.

3. Tabs for Email and Phone Login

Users can switch between email and phone login effortlessly using an intuitive tab system.

4. Password Visibility Toggle

A small but essential feature, allowing users to toggle password visibility for easier input.

5. Social Login Options

Users can log in using their Google, GitHub, or LinkedIn accounts for faster access.

6. Responsive and Mobile-Friendly

The login page is fully responsive, ensuring a smooth experience across all devices.

Steps to Create an Ultra-Modern Login Page

Step 1: Structure with HTML

First, create the basic structure, including a left panel with branding and a right panel with the login form.

Step 2: Styling with CSS

Use modern fonts, gradients, and smooth animations to give the login page an elegant touch.

Step 3: Adding JavaScript for Interactivity

Use JavaScript to enable tab switching, password visibility toggle, and other dynamic features.

Best Practices for Login Page Design

  • Keep It Simple: Avoid clutter and focus on a clean, minimal design.
  • Use Secure Inputs: Ensure password fields are properly encrypted and protected.
  • Provide Helpful Feedback: Display error messages or success alerts for better user experience.
  • Optimize for Performance: Minimize unnecessary animations and heavy graphics.
  • Test for Responsiveness: Ensure the login page adapts well to different screen sizes.

Source Code

  • Step 1: Setting Up the HTML Structure
  • Step 2: Adding Styling with CSS
  • Step 3: Adding Interactivity with JavaScript
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ultra Modern Login Experience</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap"
rel="stylesheet"
/>
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<!-- Background Elements -->
<div class="background">
<div class="noise"></div>
<div class="grid"></div>
<div class="gradient-sphere sphere-1"></div>
<div class="gradient-sphere sphere-2"></div>
</div>
<!-- Main Content -->
<div class="login-page">
<!-- Left Panel with intro content -->
<div class="left-panel">
<!-- Brand Logo -->
<div class="brand fade-in fade-in-1">
<div class="logo">CV</div>
<div class="logo-text">CodingVox</div>
</div>
<!-- Intro Text -->
<div class="intro-text fade-in fade-in-2">
<h1>Seamless access to your digital workspace</h1>
<p>
Connect with your team, manage projects, and drive success with our
intuitive platform.
</p>
</div>
<!-- Features List -->
<div class="features fade-in fade-in-3">
<div class="feature">
<div class="feature-icon">
<i class="fa-solid fa-shield-halved"></i>
</div>
<div class="feature-text">Enterprise-grade security</div>
</div>
<div class="feature">
<div class="feature-icon">
<i class="fa-solid fa-users-gear"></i>
</div>
<div class="feature-text">Real-time collaboration</div>
</div>
<div class="feature">
<div class="feature-icon">
<i class="fa-solid fa-chart-line"></i>
</div>
<div class="feature-text">Advanced analytics</div>
</div>
</div>
<!-- Footer -->
<div class="footer fade-in fade-in-4">
<span>© 2025 Nebula. All rights reserved.</span>
<nav>
<ul>
<li><a href="#">Terms</a></li>
<li><a href="#">Privacy</a></li>
<li><a href="#">Help</a></li>
</ul>
</nav>
</div>
</div>
<!-- Right Panel with login form -->
<div class="right-panel">
<div class="login-container">
<div class="login-header">
<h2>Welcome back</h2>
<p>Sign in to your account to continue</p>
</div>
<!-- Login tabs -->
<div class="tabs">
<button class="tab active">Email</button>
<button class="tab">Phone</button>
<div class="tab-bg"></div>
</div>
<!-- Login form -->
<form>
<div class="form-group">
<label for="email">Email address</label>
<div class="input-with-icon">
<input
type="email"
id="email"
class="input-field"
placeholder="name@example.com"
required
/>
<i class="fa-regular fa-envelope form-icon"></i>
</div>
</div>
<div class="form-group">
<label for="password">Password</label>
<div class="input-with-icon">
<input
type="password"
id="password"
class="input-field"
placeholder="Enter your password"
required
/>
<i class="fa-solid fa-lock form-icon"></i>
<button type="button" class="password-toggle">
<i class="fa-regular fa-eye"></i>
</button>
</div>
</div>
<div class="form-extras">
<div class="remember-me">
<input type="checkbox" id="remember" checked />
<label for="remember">Remember me</label>
</div>
<div class="forgot-password">
<a href="#">Forgot password?</a>
</div>
</div>
<button type="submit" class="login-button">Sign In</button>
<div class="separator">Or continue with</div>
<div class="social-login">
<div class="social-btn">
<i class="fa-brands fa-google"></i>
</div>
<div class="social-btn">
<i class="fa-brands fa-github"></i>
</div>
<div class="social-btn">
<i class="fa-brands fa-linkedin-in"></i>
</div>
</div>
<div class="signup-link">
Don't have an account? <a href="#">Create account</a>
</div>
</form>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont,
sans-serif;
}
:root {
--primary: #6366f1;
--primary-light: #818cf8;
--primary-dark: #4f46e5;
--accent: #10b981;
--dark: #0f172a;
--darker: #020617;
--light: #f1f5f9;
--white: #ffffff;
--gray-100: #f3f4f6;
--gray-200: #e5e7eb;
--gray-300: #d1d5db;
--gray-400: #9ca3af;
--gray-500: #6b7280;
--text-dark: #1e293b;
--text-light: #64748b;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 2px 4px -1px rgba(0, 0, 0, 0.06);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
0 4px 6px -2px rgba(0, 0, 0, 0.05);
--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
0 10px 10px -5px rgba(0, 0, 0, 0.04);
--transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
--ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}
body {
background-color: var(--dark);
display: flex;
color: var(--text-light);
font-size: 16px;
line-height: 1.5;
position: relative;
overflow-x: hidden;
}
/* Animated Background */
.background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -2;
background: radial-gradient(
circle at top right,
var(--darker) 0%,
var(--dark) 100%
);
overflow: hidden;
}
.noise {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
z-index: -1;
opacity: 0.3;
}
.grid {
position: absolute;
width: 100%;
height: 100%;
background-size: 40px 40px;
background-image: linear-gradient(
to right,
rgba(255, 255, 255, 0.02) 1px,
transparent 1px
),
linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
z-index: -1;
}
.gradient-sphere {
position: absolute;
border-radius: 50%;
filter: blur(60px);
}
.sphere-1 {
width: 400px;
height: 400px;
top: -100px;
right: -100px;
background: radial-gradient(
circle at center,
rgba(99, 102, 241, 0.15),
rgba(99, 102, 241, 0) 70%
);
animation: float 20s ease-in-out infinite alternate;
}
.sphere-2 {
width: 300px;
height: 300px;
bottom: -50px;
left: -100px;
background: radial-gradient(
circle at center,
rgba(16, 185, 129, 0.1),
rgba(16, 185, 129, 0) 70%
);
animation: float 25s ease-in-out infinite alternate-reverse;
}
@keyframes float {
0% {
transform: translate(0, 0) scale(1);
}
50% {
transform: translate(-5%, 5%) scale(1.1);
}
100% {
transform: translate(5%, -5%) scale(0.9);
}
}
/* Main Layout */
.login-page {
display: flex;
flex-direction: row;
width: 100%;
}
.left-panel {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 2.5rem;
position: relative;
min-width: 400px;
}
.right-panel {
width: 550px;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
position: relative;
overflow: hidden;
}
@media (max-width: 1100px) {
.login-page {
flex-direction: column;
}
.left-panel,
.right-panel {
width: 100%;
min-width: unset;
}
.left-panel {
height: auto;
padding: 2rem 2rem 1rem;
}
.right-panel {
flex: 1;
padding: 0 2rem 2rem;
}
}
/* Brand Logo & Header */
.brand {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 1rem;
}
.logo {
width: 42px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10px;
background: linear-gradient(
135deg,
var(--primary) 0%,
var(--primary-dark) 100%
);
color: var(--white);
font-weight: 700;
font-size: 1.25rem;
position: relative;
overflow: hidden;
}
.logo::before {
content: "";
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
to bottom right,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.1) 50%,
rgba(255, 255, 255, 0) 100%
);
transform: rotate(45deg);
animation: shine 6s infinite;
}
@keyframes shine {
0% {
top: -100%;
left: -100%;
}
20% {
top: 100%;
left: 100%;
}
100% {
top: 100%;
left: 100%;
}
}
.logo-text {
font-size: 1.5rem;
font-weight: 700;
background: linear-gradient(to right, var(--white), var(--gray-300));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.intro-text {
margin-top: 3rem;
margin-bottom: 2rem;
max-width: 480px;
}
.intro-text h1 {
font-size: 3rem;
font-weight: 700;
line-height: 1.2;
margin-bottom: 1.25rem;
background: linear-gradient(to right, var(--white), var(--gray-300));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.intro-text p {
font-size: 1.125rem;
font-weight: 400;
line-height: 1.6;
color: var(--gray-400);
}
.features {
display: flex;
flex-direction: column;
gap: 1.25rem;
margin-bottom: 2rem;
}
.feature {
display: flex;
align-items: center;
gap: 1rem;
}
.feature-icon {
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10px;
background: rgba(99, 102, 241, 0.1);
color: var(--primary-light);
}
.feature-text {
font-size: 1rem;
font-weight: 500;
color: var(--gray-300);
}
/* Footer */
.footer {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.875rem;
color: var(--gray-500);
margin-top: auto;
padding-top: 2rem;
}
.footer nav ul {
display: flex;
list-style: none;
gap: 1.5rem;
}
.footer nav a {
color: var(--gray-400);
text-decoration: none;
transition: var(--transition);
}
.footer nav a:hover {
color: var(--white);
}
/* Login Form */
.login-container {
width: 100%;
max-width: 480px;
padding: 2.5rem;
background: rgba(15, 23, 42, 0.4);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-radius: 24px;
border: 1px solid rgba(255, 255, 255, 0.05);
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
animation: slideUp 0.8s var(--ease-out-expo) forwards;
transform: translateY(30px);
opacity: 0;
overflow: hidden;
position: relative;
}
.login-container::before {
content: "";
position: absolute;
inset: 0;
border-radius: 24px;
padding: 1px;
background: linear-gradient(
to bottom right,
rgba(99, 102, 241, 0.6),
rgba(16, 185, 129, 0.1),
rgba(99, 102, 241, 0)
);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
}
@keyframes slideUp {
0% {
transform: translateY(30px);
opacity: 0;
}
100% {
transform: translateY(0);
opacity: 1;
}
}
/* Login header */
.login-header {
margin-bottom: 2.5rem;
text-align: left;
}
.login-header h2 {
font-size: 2rem;
margin-bottom: 0.75rem;
color: var(--white);
font-weight: 700;
}
.login-header p {
color: var(--gray-400);
font-size: 1rem;
}
.tabs {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
position: relative;
}
.tab {
padding: 0.5rem 1rem;
border-radius: 8px;
font-weight: 500;
color: var(--gray-400);
cursor: pointer;
transition: var(--transition);
background: transparent;
border: none;
font-size: 0.95rem;
position: relative;
z-index: 2;
}
.tab.active {
color: var(--white);
}
.tab-bg {
position: absolute;
height: 100%;
border-radius: 8px;
background: rgba(255, 255, 255, 0.05);
transition: var(--transition);
left: 0;
top: 0;
width: 110px;
z-index: 1;
}
/* Form elements */
.form-group {
margin-bottom: 1.75rem;
position: relative;
}
.form-group label {
display: block;
margin-bottom: 0.75rem;
font-size: 0.95rem;
color: var(--gray-300);
font-weight: 500;
}
.input-with-icon {
position: relative;
}
.form-icon {
position: absolute;
left: 16px;
top: 50%;
transform: translateY(-50%);
color: var(--gray-500);
pointer-events: none;
transition: var(--transition);
}
.input-field {
width: 100%;
padding: 0.95rem 1rem 0.95rem 2.8rem;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 14px;
color: var(--white);
font-size: 0.95rem;
transition: var(--transition);
outline: none;
}
.input-field:focus {
border-color: var(--primary);
background: rgba(255, 255, 255, 0.05);
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}
.input-field:focus + .form-icon {
color: var(--primary-light);
}
.input-field::placeholder {
color: var(--gray-500);
opacity: 0.7;
}
.password-toggle {
position: absolute;
right: 16px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
cursor: pointer;
color: var(--gray-500);
display: flex;
align-items: center;
justify-content: center;
transition: var(--transition);
}
.password-toggle:hover {
color: var(--primary-light);
}
/* Remember me & Forgot password */
.form-extras {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
}
.remember-me {
display: flex;
align-items: center;
gap: 0.5rem;
}
.remember-me input[type="checkbox"] {
appearance: none;
width: 18px;
height: 18px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 5px;
background-color: rgba(255, 255, 255, 0.03);
cursor: pointer;
position: relative;
transition: var(--transition);
}
.remember-me input[type="checkbox"]:checked {
background-color: var(--primary);
border-color: var(--primary);
}
.remember-me input[type="checkbox"]:checked::after {
content: "";
position: absolute;
width: 5px;
height: 10px;
border-right: 2px solid white;
border-bottom: 2px solid white;
top: 50%;
left: 50%;
transform: translate(-50%, -60%) rotate(45deg);
}
.remember-me label {
font-size: 0.85rem;
color: var(--gray-400);
cursor: pointer;
}
.forgot-password a {
color: var(--gray-400);
font-size: 0.85rem;
text-decoration: none;
transition: var(--transition);
font-weight: 500;
}
.forgot-password a:hover {
color: var(--primary-light);
}
/* Login Button */
.login-button {
width: 100%;
padding: 1rem;
background: linear-gradient(to right, var(--primary), var(--primary-dark));
border: none;
border-radius: 14px;
color: var(--white);
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: var(--transition);
margin-bottom: 2rem;
position: relative;
overflow: hidden;
z-index: 1;
}
.login-button::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(to right, var(--primary-dark), var(--primary));
z-index: -1;
transition: opacity 0.5s ease;
opacity: 0;
}
.login-button:hover::before {
opacity: 1;
}
.login-button:hover {
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}
.login-button:active {
transform: translateY(0);
}
/* Social Login */
.separator {
display: flex;
align-items: center;
text-align: center;
margin-bottom: 1.5rem;
color: var(--gray-500);
font-size: 0.85rem;
}
.separator::before,
.separator::after {
content: "";
flex: 1;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.separator::before {
margin-right: 1rem;
}
.separator::after {
margin-left: 1rem;
}
.social-login {
display: flex;
justify-content: center;
gap: 1rem;
margin-bottom: 2rem;
}
.social-btn {
display: flex;
justify-content: center;
align-items: center;
width: 3.5rem;
height: 3.5rem;
border-radius: 14px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.07);
cursor: pointer;
transition: var(--transition);
color: var(--gray-300);
}
.social-btn:hover {
transform: translateY(-3px);
background: rgba(255, 255, 255, 0.07);
border-color: rgba(255, 255, 255, 0.12);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.social-btn:active {
transform: translateY(0);
}
.social-btn i {
font-size: 1.25rem;
transition: var(--transition);
}
.social-btn:hover i {
transform: scale(1.1);
}
.signup-link {
text-align: center;
font-size: 0.95rem;
color: var(--gray-400);
}
.signup-link a {
color: var(--primary-light);
text-decoration: none;
font-weight: 600;
transition: var(--transition);
}
.signup-link a:hover {
text-decoration: underline;
}
/* Responsive Styles */
@media (max-width: 1100px) {
.intro-text h1 {
font-size: 2.25rem;
}
.features {
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 1rem;
}
.feature {
width: calc(50% - 0.5rem);
}
.footer {
padding-top: 1rem;
}
}
@media (max-width: 768px) {
.login-container {
padding: 2rem;
}
.login-header h2 {
font-size: 1.75rem;
}
.intro-text {
margin-top: 1.5rem;
margin-bottom: 1.5rem;
}
.intro-text p {
font-size: 1rem;
}
.footer {
flex-direction: column;
gap: 1rem;
align-items: flex-start;
}
}
@media (max-width: 640px) {
.features {
flex-direction: column;
}
.feature {
width: 100%;
}
.form-extras {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
}
.login-container {
padding: 1.75rem;
}
.login-header h2 {
font-size: 1.5rem;
}
.footer nav ul {
flex-wrap: wrap;
gap: 1rem 1.5rem;
}
}
/* Animations */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.fade-in {
opacity: 0;
animation: fadeIn 0.8s ease forwards;
}
.fade-in-1 {
animation-delay: 0.2s;
}
.fade-in-2 {
animation-delay: 0.4s;
}
.fade-in-3 {
animation-delay: 0.6s;
}
.fade-in-4 {
animation-delay: 0.8s;
}
javascript
document.querySelectorAll(".tab").forEach((tab) => {
tab.addEventListener("click", function () {
document
.querySelectorAll(".tab")
.forEach((t) => t.classList.remove("active"));
this.classList.add("active");
const tabBg = document.querySelector(".tab-bg");
tabBg.style.left = this.offsetLeft + "px";
tabBg.style.width = this.offsetWidth + "px";
});
});
document
.querySelector(".password-toggle")
.addEventListener("click", function () {
const passwordInput = document.getElementById("password");
const type =
passwordInput.getAttribute("type") === "password" ? "text" : "password";
passwordInput.setAttribute("type", type);
const eyeIcon = this.querySelector("i");
if (type === "text") {
eyeIcon.classList.remove("fa-eye");
eyeIcon.classList.add("fa-eye-slash");
} else {
eyeIcon.classList.remove("fa-eye-slash");
eyeIcon.classList.add("fa-eye");
}
});

Conclusion

Creating an ultra-modern login page with HTML, CSS, and JavaScript enhances user experience, improves security, and gives your website a professional look. With interactive elements like animations, password toggles, and social logins, you can make the login process seamless and enjoyable. Implement these techniques in your next project and take your UI to the next level!

Do you want to build more stylish and functional UI components? Stay tuned for more tutorials!

C
CodingVox

Web Developer and Content Creator

ultra-modern login pageHTML CSS JavaScript loginstylish login UIanimated login form