Dark Theme 3D Projected Login Form using Html

Here's a complete HTML, CSS, and JavaScript implementation of a login form with a dark theme, red-orange gradient border, and 3D projection effect:

This dark-themed login form features a modern aesthetic with a #1e1e1e background, enhanced by a striking 2px red-to-orange gradient border created using a pseudo-element. The design incorporates 3D projection effects through CSS transforms including perspective() and rotateX(), with a hover effect that intensifies the dimensional appearance and subtle shadow blur for added depth. Interactive elements include animated input labels that elevate when focused, a button with hover and active states, and basic form validation. Visual enhancements consist of a glow effect on focused inputs, strategically placed subtle shadows throughout the interface, and smooth CSS transitions for all interactive components, creating a polished and dynamic user experience.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>3D Dark Login Form</title> </head> <body> <div class="login-container"> <h2>Login</h2> <form id="loginForm"> <div class="input-group"> <input type="text" id="username" required> <label for="username">Username</label> </div> <div class="input-group"> <input type="password" id="password" required> <label for="password">Password</label> </div> <a href="#" class="forgot-pass">Forgot Password?</a> <button type="submit" class="login-btn">Login</button> <p class="signup-link">Don't have an account? <a href="#">Sign up</a></p> </form> </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 {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: #121212;
        }

        .login-container {
            position: relative;
            width: 380px;
            padding: 40px 30px;
            background: #1e1e1e;
            border-radius: 10px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
            transform-style: preserve-3d;
            transform: perspective(1000px) rotateX(10deg);
            transition: all 0.5s ease;
        }

        .login-container::before {
            content: '';
            position: absolute;
            inset: -2px;
            border-radius: 12px;
            background: linear-gradient(45deg, #ff0000, #ff8c00);
            z-index: -1;
            transform: translateZ(-20px);
            filter: blur(5px);
        }

        .login-container:hover {
            transform: perspective(1000px) rotateX(5deg) translateY(-10px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
        }

        .login-container h2 {
            color: #fff;
            font-size: 2em;
            text-align: center;
            margin-bottom: 30px;
            text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
        }

        .input-group {
            position: relative;
            margin-bottom: 30px;
        }

        .input-group input {
            width: 100%;
            padding: 15px 20px;
            background: #2d2d2d;
            border: none;
            outline: none;
            border-radius: 5px;
            color: #fff;
            font-size: 1em;
            box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
            transition: all 0.3s ease;
        }

        .input-group input:focus {
            box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 140, 0, 0.3);
        }

        .input-group label {
            position: absolute;
            top: 15px;
            left: 20px;
            color: #aaa;
            pointer-events: none;
            transition: all 0.3s ease;
        }

        .input-group input:focus ~ label,
        .input-group input:valid ~ label {
            top: -10px;
            left: 10px;
            font-size: 0.8em;
            background: #1e1e1e;
            padding: 0 10px;
            color: #ff8c00;
        }

        .forgot-pass {
            display: block;
            text-align: right;
            margin: -15px 0 20px;
            color: #aaa;
            text-decoration: none;
            font-size: 0.9em;
            transition: color 0.3s;
        }

        .forgot-pass:hover {
            color: #ff8c00;
        }

        .login-btn {
            width: 100%;
            padding: 15px;
            background: linear-gradient(45deg, #ff0000, #ff8c00);
            border: none;
            border-radius: 5px;
            color: #fff;
            font-size: 1.1em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 5px 15px rgba(255, 69, 0, 0.4);
        }

        .login-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(255, 69, 0, 0.6);
        }

        .login-btn:active {
            transform: translateY(0);
            box-shadow: 0 5px 15px rgba(255, 69, 0, 0.4);
        }

        .signup-link {
            display: block;
            text-align: center;
            margin-top: 25px;
            color: #aaa;
        }

        .signup-link a {
            color: #ff8c00;
            text-decoration: none;
            font-weight: 600;
            transition: color 0.3s;
        }

        .signup-link a:hover {
            color: #ff0000;
        }
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 username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            
            // Basic validation
            if(username.trim() === '' || password.trim() === '') {
                alert('Please fill in all fields');
                return;
            }
            
            // Here you would typically send the data to a server
            console.log('Login attempt with:', { username, password });
            
            // For demo purposes, show a success message
            alert('Login successful! (This is a demo)');
            
            // Reset the form
            this.reset();
        });

        // Add animation effect to input fields when focused
        document.querySelectorAll('.input-group input').forEach(input => {
            input.addEventListener('focus', function() {
                this.parentNode.style.transform = 'translateZ(10px)';
            });
            
            input.addEventListener('blur', function() {
                this.parentNode.style.transform = 'translateZ(0)';
            });
        });
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