Google Advertisement

Modern CSS Login Form UI Design Tutorial for Beginners

Google Advertisement
πŸ”₯ Read with Full Features on Our Website

Learn how to create a stylish and responsive login form using modern CSS. This step-by-step tutorial is perfect for beginners who want to build a clean and professional-looking login UI.

Published on 24 May 2025
By Vandu

Create a Login Form UI with Modern Styling in CSS

A login form is one of the most essential components of any website or web application. In this tutorial, we will create a modern-looking login form using HTML and CSS, and explain each line of code in a simple, beginner-friendly way.

πŸ”₯ Read with Full Features on Our Website

Let’s build a beautiful and clean UI form that you can use in your projects!


🎯 What Will You Learn?


🧱 Step 1: HTML Structure

Let’s start by writing the basic HTML for our login form.

πŸ”Έ HTML Code

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Modern Login Form</title>
  <link rel="stylesheet" href="style.css" />
</head>
<body>
  <div class="login-container">
    <form class="login-form">
      <h2>Login</h2>
      <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>
 

πŸ” HTML Explanation


🎨 Step 2: CSS Styling

Now let’s style the login form to make it look modern and professional.

πŸ”Έ CSS Code (style.css)

/* Reset default margin and padding */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

/* Full screen background with center alignment */
body {
  height: 100vh;
  background: linear-gradient(to right, #6a11cb, #2575fc);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Container for the form */
.login-container {
  background: white;
  padding: 40px 30px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

/* Form heading */
.login-form h2 {
  text-align: center;
  margin-bottom: 20px;
  color: #333;
}

/* Input group */
.input-group {
  margin-bottom: 20px;
}

/* Labels */
.input-group label {
  display: block;
  margin-bottom: 6px;
  color: #555;
  font-weight: 600;
}

/* Inputs */
.input-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  transition: border 0.3s;
}

.input-group input:focus {
  border-color: #2575fc;
  outline: none;
}

/* Button styling */
button {
  width: 100%;
  padding: 12px;
  border: none;
  background: #2575fc;
  color: white;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
}

button:hover {
  background: #1a5ed1;
}
 

πŸ” CSS Explanation

πŸ”Ή General Styling

πŸ”Ή Container

πŸ”Ή Form Elements


πŸ“± Step 3: Making It Responsive

This layout is already responsive because we’re using:

It works well on both desktop and mobile devices.


βœ… Final Output Preview

When you load this form in your browser, you'll see:


πŸ“Œ Bonus Tips


🎁 Conclusion

You just built a beautiful and modern login form UI using only HTML and CSS! This design is perfect for integrating into any login or authentication page of your website.

With a clean structure and stylish look, your login forms will not only be user-friendly but also visually impressive.

❀️ Like πŸ’¬ Comment πŸ”— Share
Google Advertisement
πŸ‘‰ View Full Version on Main Website β†—
Google Advertisement
πŸ‘‰ Read Full Article on Website