HTML

Glassmorphism Login Form: A Modern Design Tutorial

Apr 30, 2025, 6:06 AM
Blog Thumbnail

Creating a Glassmorphism Login Form with HTML & CSS

In this tutorial, we'll walk through creating a modern login form that leverages the trendy glassmorphism design. This technique uses a translucent background with a subtle blur effect to produce a sleek and futuristic look.

Overview

Glassmorphism is all about creating a frosted glass effect by combining transparency with a backdrop blur. The login form below features a glass-like card that stands out against a vibrant gradient background. It's a perfect example of how minimal design can create a powerful visual impact.

Code Example

Copy the code below into an HTML file to implement this glassmorphism login form:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Glassmorphism Login Form</title>
  <style>
    /* Reset styles */
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    body {
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      background: linear-gradient(135deg, #2c3e50, #3498db);
      font-family: Arial, sans-serif;
    }
    .login-container {
      background: rgba(255, 255, 255, 0.2);
      box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-radius: 10px;
      border: 1px solid rgba(255, 255, 255, 0.18);
      padding: 40px;
      width: 300px;
      text-align: center;
    }
    .login-container h2 {
      margin-bottom: 20px;
      color: #fff;
      text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    .login-container .input-group {
      margin-bottom: 20px;
      text-align: left;
    }
    .login-container label {
      display: block;
      margin-bottom: 5px;
      color: #fff;
    }
    .login-container input {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 5px;
      outline: none;
    }
    .login-container button {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 5px;
      background: #3498db;
      color: #fff;
      cursor: pointer;
      transition: background 0.3s;
    }
    .login-container button:hover {
      background: #2980b9;
    }
  </style>
</head>
<body>
  <div class="login-container">
    <h2>Welcome Back</h2>
    <form>
      <div class="input-group">
        <label for="username">Username</label>
        <input type="text" id="username" placeholder="Enter your username" required>
      </div>
      <div class="input-group">
        <label for="password">Password</label>
        <input type="password" id="password" placeholder="Enter your password" required>
      </div>
      <button type="submit">Login</button>
    </form>
  </div>
</body>
</html>

Conclusion

This glassmorphism login form is a striking, modern approach to user authentication design. Its translucent card, combined with a backdrop blur effect, creates an interface that is both elegant and functional. Customize the colors, spacing, and text to match your brand’s style and give your website a contemporary edge.

Enjoy experimenting with this design and happy coding!