Design a glassmorphism login page in html css

Key Features:
Glassmorphism Effect:

  • Semi-transparent background with backdrop-filter: blur(10px)
  • Subtle border with border: 1px solid rgba(255, 255, 255, 0.18)
  • Soft shadow effect with box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2)

Modern UI Elements:

  • Clean sans-serif font (Segoe UI system font stack)
  • Minimal Font Awesome icons for inputs
  • Floating animation on the card for added dimension

Interactive Elements:

  • Hover effects on inputs (light background change)
  • Focus states with soft glow
  • Animated button with transform on hover
  • Subtle underline animation on links

Background Design:

  • Gradient background (purple/blue)
  • Abstract circular shapes in the background
  • Radial gradient overlay on the card for depth

Responsive Design:

  • Adapts to mobile screens with adjusted padding
  • Maintains readability on all devices
  • Proper scaling of all elements

Visual Enhancements:

  • Consistent transparency levels
  • Proper contrast for readability
  • Smooth transitions for all interactive elements

The design achieves a modern, frosted glass appearance while maintaining excellent usability. The form is fully functional and can be connected to your backend by adding appropriate form handling in JavaScript.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Glassmorphism 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 floating"> <div class="login-header"> <h1>Welcome Back</h1> <p>Please enter your credentials to login</p> </div> <form> <div class="input-group"> <i class="fas fa-user"></i> <input type="text" placeholder="Username or Email" required> </div> <div class="input-group"> <i class="fas fa-lock"></i> <input type="password" placeholder="Password" required> </div> <button type="submit" class="login-btn">Login</button> <div class="login-footer"> <p>Don't have an account? <a href="#">Sign up</a></p> <p><a href="#">Forgot password?</a></p> </div> </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.


/* Base Styles */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            background-attachment: fixed;
            padding: 20px;
            position: relative;
            overflow: hidden;
        }

        /* Background Shapes */
        body::before,
        body::after {
            content: '';
            position: absolute;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(5px);
            z-index: -1;
        }

        body::before {
            width: 300px;
            height: 300px;
            top: -50px;
            left: -50px;
        }

        body::after {
            width: 200px;
            height: 200px;
            bottom: -50px;
            right: -50px;
        }

        /* Glass Card */
        .login-container {
            width: 100%;
            max-width: 400px;
            padding: 40px 30px;
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: 20px;
            border: 1px solid rgba(255, 255, 255, 0.18);
            box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
            color: white;
            position: relative;
            overflow: hidden;
            z-index: 1;
        }

        .login-container::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            z-index: -1;
        }

        /* Form Elements */
        .login-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-header h1 {
            font-weight: 600;
            font-size: 2rem;
            margin-bottom: 10px;
        }

        .login-header p {
            opacity: 0.8;
            font-weight: 300;
        }

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

        .input-group i {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            opacity: 0.8;
        }

        .input-group input {
            width: 100%;
            padding: 15px 15px 15px 45px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 10px;
            color: white;
            font-size: 1rem;
            transition: all 0.3s ease;
        }

        .input-group input::placeholder {
            color: rgba(255, 255, 255, 0.6);
        }

        .input-group input:focus {
            outline: none;
            background: rgba(255, 255, 255, 0.2);
            border-color: rgba(255, 255, 255, 0.4);
            box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
        }

        .input-group input:hover {
            background: rgba(255, 255, 255, 0.15);
        }

        .login-btn {
            width: 100%;
            padding: 15px;
            background: rgba(255, 255, 255, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 10px;
            color: white;
            font-size: 1rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-top: 10px;
        }

        .login-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .login-btn:active {
            transform: translateY(0);
        }

        .login-footer {
            text-align: center;
            margin-top: 30px;
            font-size: 0.9rem;
            opacity: 0.8;
        }

        .login-footer a {
            color: white;
            text-decoration: none;
            font-weight: 500;
            transition: opacity 0.3s;
        }

        .login-footer a:hover {
            opacity: 1;
            text-decoration: underline;
        }

        /* Responsive Design */
        @media (max-width: 480px) {
            .login-container {
                padding: 30px 20px;
                border-radius: 15px;
            }

            .login-header h1 {
                font-size: 1.8rem;
            }

            .input-group input {
                padding: 12px 12px 12px 40px;
            }
        }

        /* Animation for floating elements */
        @keyframes float {
            0%, 100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-10px);
            }
        }

        .floating {
            animation: float 6s ease-in-out infinite;
        }
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.


// No Script:

We hope you would like this Calculator using html css and javascript code

Thank you
Learning robo team

إرسال تعليق

Thank you
Learning robo team

Post a Comment (0)

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