Simple Dark-themed Sign In Form In Html With Css Code

I've created a sleek, minimalist dark-themed login page with subtle decorative elements and smooth interactions. The design features a fullscreen dark gradient background with SVG decorative shapes, a centered login card with rounded corners, and elegant form elements with smooth hover effects.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dark Login</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> </head> <body> <div class="login-container"> <div class="login-header"> <h1>Welcome Back</h1> <p>Please sign in to your account</p> </div> <form id="loginForm"> <div class="input-group"> <label for="email">Email Address</label> <input type="email" id="email" placeholder="Enter your email" required> <i class="fas fa-envelope"></i> </div> <div class="input-group"> <label for="password">Password</label> <input type="password" id="password" placeholder="Enter your password" required> <i class="fas fa-lock"></i> </div> <div class="remember-forgot"> <div class="remember"> <input type="checkbox" id="remember"> <label for="remember">Remember me</label> </div> <div class="forgot"> <a href="#">Forgot password?</a> </div> </div> <button type="submit" class="login-btn">Sign In</button> </form> <div class="divider"> <span>Or continue with</span> </div> <div class="social-login"> <button class="social-btn facebook"> <i class="fab fa-facebook-f"></i> </button> <button class="social-btn google"> <i class="fab fa-google"></i> </button> <button class="social-btn twitter"> <i class="fab fa-twitter"></i> </button> </div> <div class="signup-link"> Don't have an account? <a href="#">Sign up</a> </div> </div> </body> </html>
CSS provides style to an HTML page. To make the page attractive create a CSS file with the name style.css and remember that you have to make a file with a .css extension.

* {

            margin: 0;

            padding: 0;

            box-sizing: border-box;

            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

        }

        body {

            min-height: 100vh;

            display: flex;

            justify-content: center;

            align-items: center;

            background: linear-gradient(135deg, #0f172a, #1e293b);

            padding: 20px;

            position: relative;

            overflow: hidden;

        }

        /* Decorative shapes */

        .shape {

            position: absolute;

            border-radius: 50%;

            opacity: 0.1;

            z-index: -1;

        }

        .shape-1 {

            width: 300px;

            height: 300px;

            background: linear-gradient(45deg, #6366f1, #8b5cf6);

            top: -100px;

            left: -100px;

        }

        .shape-2 {

            width: 200px;

            height: 200px;

            background: linear-gradient(45deg, #ec4899, #8b5cf6);

            bottom: -50px;

            right: -50px;

        }

        .shape-3 {

            width: 150px;

            height: 150px;

            background: linear-gradient(45deg, #3b82f6, #10b981);

            top: 50%;

            right: 20%;

        }

        /* Login card */

        .login-card {

            background: #1e293b;

            padding: 40px;

            border-radius: 16px;

            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);

            width: 100%;

            max-width: 420px;

            backdrop-filter: blur(10px);

            border: 1px solid rgba(255, 255, 255, 0.1);

        }

        .login-header {

            margin-bottom: 30px;

            text-align: center;

        }

        .login-header h1 {

            color: #f8fafc;

            font-size: 28px;

            font-weight: 600;

            margin-bottom: 10px;

        }

        .login-header p {

            color: #94a3b8;

            font-size: 16px;

        }

        /* Form elements */

        .form-group {

            margin-bottom: 20px;

        }

        label {

            display: block;

            color: #cbd5e1;

            margin-bottom: 8px;

            font-size: 14px;

            font-weight: 500;

        }

        input[type="email"],

        input[type="password"] {

            width: 100%;

            padding: 14px;

            background: #2d3748;

            border: 1px solid #3f4a5f;

            border-radius: 8px;

            color: #f1f5f9;

            font-size: 16px;

            transition: all 0.3s ease;

        }

        input[type="email"]:focus,

        input[type="password"]:focus {

            outline: none;

            border-color: #6366f1;

            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);

        }

        input[type="email"]:hover,

        input[type="password"]:hover {

            border-color: #6366f1;

        }

        /* Checkbox */

        .remember {

            display: flex;

            align-items: center;

            margin-bottom: 25px;

        }

        .remember input {

            margin-right: 10px;

            accent-color: #6366f1;

        }

        .remember label {

            margin: 0;

            color: #cbd5e1;

        }

        /* Button */

        .sign-in-btn {

            width: 100%;

            padding: 14px;

            background: #6366f1;

            color: white;

            border: none;

            border-radius: 8px;

            font-size: 16px;

            font-weight: 600;

            cursor: pointer;

            transition: all 0.3s ease;

        }

        .sign-in-btn:hover {

            background: #4f46e5;

            transform: translateY(-2px);

            box-shadow: 0 5px 15px rgba(79, 70, 229, 0.4);

        }

        .sign-in-btn:active {

            transform: translateY(0);

        }

        /* Forgot password */

        .forgot-password {

            text-align: center;

            margin-top: 20px;

        }

        .forgot-password a {

            color: #94a3b8;

            text-decoration: none;

            font-size: 14px;

            transition: color 0.3s ease;

        }

        .forgot-password a:hover {

            color: #6366f1;

        }

        /* Responsive design */

        @media (max-width: 480px) {

            .login-card {

                padding: 30px 20px;

            }

            

            .login-header h1 {

                font-size: 24px;

            }

            

            input[type="email"],

            input[type="password"],

            .sign-in-btn {

                padding: 12px;

            }

        }


JavaScript makes the page work functionally. At last, create a JavaScript file with the name of script.js, and remember that you've got to make a file with a .js extension.

  document.getElementById('loginForm').addEventListener('submit', function(e) {
            e.preventDefault();
            const email = document.getElementById('email').value;
            const password = document.getElementById('password').value;
            
            // Simple validation
            if(email && password) {
                // In a real application, you would send this data to a server
                alert('Login successful! (This is a demo)');
                
                // Reset form
                document.getElementById('loginForm').reset();
            } else {
                alert('Please fill in all fields');
            }
        });
        
        // Add some interactive effects
        const inputs = document.querySelectorAll('input');
        inputs.forEach(input => {
            input.addEventListener('focus', function() {
                this.parentElement.querySelector('i').style.color = '#7e67e5';
            });
            
            input.addEventListener('blur', function() {
                this.parentElement.querySelector('i').style.color = '#a0a0a0';
            });
        });
We hope you Like this Post Thanks for coming Here

Thank you
Learning robo team

إرسال تعليق

Thank you
Learning robo team

Post a Comment (0)

أحدث أقدم
Learning Robo says...
code copied