Password Reset Form with Password Rules

This password reset form includes visible password rules to help users create strong and secure passwords.

HTML

<form class="reset-rules">
  <h3>Set New Password</h3>
  <p class="subtitle">Your password must meet the following rules</p>

  <input type="password" placeholder="New password" required>
  <input type="password" placeholder="Confirm password" required>

  <ul class="rules">
    <li>At least 8 characters</li>
    <li>One uppercase letter</li>
    <li>One number</li>
    <li>One special character</li>
  </ul>

  <button type="button">Update Password</button>
</form>

In production, update rule states dynamically with JavaScript.

CSS

:root{
  --bg:#f8fafc;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;

  --primary:#4f46e5;
  --primary-dark:#4338ca;
  --success:#16a34a;
}

@media (prefers-color-scheme: dark){
  :root{
    --bg:#020617;
    --card:#020617;
    --text:#e5e7eb;
    --muted:#94a3b8;
    --border:#1f2937;

    --primary:#6366f1;
    --primary-dark:#818cf8;
    --success:#22c55e;
  }
}


body{
  background:var(--bg);
  font-family:system-ui, -apple-system, sans-serif;
}


.reset-rules{
  max-width:420px;
  margin:80px auto;
  padding:32px;

  background:var(--card);
  border-radius:18px;
  border:1px solid var(--border);
  box-shadow:0 16px 40px rgba(0,0,0,.12);

  color:var(--text);
  text-align:center;
}

.reset-rules h3{
  font-size:22px;
  margin-bottom:6px;
}

.reset-rules .subtitle{
  font-size:14px;
  color:var(--muted);
  margin-bottom:20px;
}

.reset-rules input{
  width:100%;
  padding:14px 16px;
  margin-bottom:16px;

  border-radius:12px;
  border:1px solid var(--border);
  background:linear-gradient(180deg,var(--card),var(--bg));
  color:var(--text);
  font-size:15px;

  outline:none;
  transition:border .2s ease, box-shadow .2s ease;
}

.reset-rules input::placeholder{
  color:var(--muted);
}

.reset-rules input:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(79,70,229,.18);
}


.rules{
  list-style:none;
  padding:0;
  margin:0 0 24px;
  text-align:left;
}

.rules li{
  font-size:13px;
  color:var(--muted);
  margin-bottom:8px;
  padding-left:22px;
  position:relative;
}

.rules li::before{
  content:"•";
  position:absolute;
  left:6px;
  color:var(--muted);
}

.rules li.valid{
  color:var(--success);
}

.rules li.valid::before{
  content:"✓";
  color:var(--success);
  font-weight:700;
}


.reset-rules button{
  width:100%;
  padding:14px;

  border:none;
  border-radius:12px;
  background:linear-gradient(
    135deg,
    var(--primary),
    var(--primary-dark)
  );

  color:#ffffff;
  font-size:15px;
  font-weight:600;
  cursor:pointer;

  transition:transform .15s ease, box-shadow .15s ease;
}

.reset-rules button:hover{
  transform:translateY(-1px);
  box-shadow:0 12px 30px rgba(0,0,0,.2);
}

.reset-rules button:active{
  transform:translateY(0);
  box-shadow:none;
}

.reset-rules button:disabled{
  opacity:.6;
  cursor:not-allowed;
  box-shadow:none;
}

Notes

  • Encourages strong passwords
  • Reduces failed resets
  • Security-focused UX

Preview styles shown. Production customization recommended.

Browse More UI Components

Explore hundreds of reusable HTML & CSS UI components built for modern web projects.
Discover buttons, cards, loaders, animations, layouts, and more all with live previews and clean, copy-paste code.

Leave a Reply

Your email address will not be published. Required fields are marked *