Snippets Form

Bootstrap 5 Login Form with Background Image

A split-panel login form with a scenic photo, floating-label fields, a show/hide password toggle and inline validation.

Bootstrap 5 No jQuery Aug 2020 6.6K views

<section class="wdw-stage">
  <div class="container" style="max-width:980px">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <div class="col-lg-5 d-none d-lg-block lg-photo position-relative">
          <div class="lg-scrim position-absolute bottom-0 start-0 end-0 p-4 text-white">
            <p class="fs-5 fw-semibold mb-1">Pick up where you left off.</p>
            <p class="small mb-0 opacity-75">Your projects, notes and team are one sign-in away.</p>
          </div>
        </div>
        <div class="col-lg-7">
          <form class="p-4 p-md-5 lg-form" id="lg-form" novalidate>
            <span class="wdw-eyebrow mb-2">Welcome back</span>
            <h2 class="wdw-heading h3 mb-2">Log in to your account</h2>
            <p class="wdw-muted mb-4">Enter your email and password to continue.</p>
            <div class="form-floating mb-3">
              <input type="email" class="form-control" id="lg-email" placeholder="[email protected]" autocomplete="email" required>
              <label for="lg-email">Email address</label>
              <div class="invalid-feedback">Enter a valid email address.</div>
            </div>
            <div class="form-floating mb-3 position-relative">
              <input type="password" class="form-control pe-5" id="lg-pass" placeholder="Password" autocomplete="current-password" required minlength="6">
              <label for="lg-pass">Password</label>
              <button type="button" class="btn btn-link lg-eye position-absolute top-50 end-0 translate-middle-y text-body-secondary" id="lg-toggle" aria-label="Show password" aria-pressed="false">
                <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>
              </button>
              <div class="invalid-feedback">Use at least 6 characters.</div>
            </div>
            <div class="d-flex justify-content-between align-items-center mb-4">
              <div class="form-check mb-0">
                <input class="form-check-input" type="checkbox" id="lg-remember">
                <label class="form-check-label" for="lg-remember">Keep me signed in</label>
              </div>
              <a href="#" class="small fw-semibold link-underline-opacity-0">Forgot password?</a>
            </div>
            <button type="submit" class="btn btn-primary rounded-pill w-100">Log in</button>
            <div class="alert alert-success d-none mt-3 mb-0 py-2" id="lg-ok" role="status">Signed in. Redirecting...</div>
            <p class="text-center wdw-muted small mt-4 mb-0">New here? <a href="#" class="fw-semibold link-underline-opacity-0">Create an account</a></p>
          </form>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.