Skip to content

Centered Login Page

Full-page Bootstrap 5 sign-in with a centered card, Google and GitHub buttons, validated email and password fields, a show password toggle and a Caps Lock warning.

Also known as: sign in page, full page login form, login screen, login with google and github

Centered Login Page live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A full-page Bootstrap 5 sign-in screen with a centered card, Google and GitHub buttons, email and password fields with validation, a show/hide password toggle, a Caps Lock warning and a "keep me signed in" option. Use it as the login page of a SaaS app, an admin panel or a member area.

How it works

The root is main.blc-page, a full-height flex container that centers its content on a dotted background. Inside, .blc-wrap limits the width and holds the .blc-card and the .blc-legal links below it. The card starts with an inline SVG .blc-logo, the heading and a short subtitle, followed by the two .blc-sso__btn buttons in a two-column grid and a .blc-divider with the text "or sign in with email".

The .blc-form uses novalidate and native constraints: type="email" with a pattern that requires a dot in the domain, and minlength="8" on the password. On submit the script adds Bootstrap's was-validated class, sets aria-invalid and aria-describedby on each .blc-input and focuses the first invalid field. A valid form shows a spinner in .blc-submit, then resets and shows the .blc-alert success message.

The .blc-pass__toggle button switches the password field between password and text and updates its icon, aria-pressed and aria-label. On keydown and keyup in the password field the script reads getModifierState('CapsLock') and shows the .blc-caps warning when Caps Lock is on.

Customization

  • --blc-accent, --blc-accent-hover and --blc-accent-rgb in .blc-page: recolor the top border of the card, the submit button, links, the checkbox and focus rings.
  • --blc-bg and --blc-dot in .blc-page: change the page background and the dot pattern, or set --blc-dot to transparent for a plain background.
  • --blc-width in .blc-page: make the card wider or narrower.
  • --blc-radius in .blc-page: adjust how round the card corners are.
  • minlength="8" on #blc-password: change the minimum password length and update the text of #blc-password-error.
  • Remove one .blc-sso__btn, or the whole .blc-sso grid and .blc-divider, if you only offer one sign-in method.
  • The window.setTimeout in the submit handler of script.js: replace it with a fetch() to your authentication endpoint and redirect on success.

Use cases

  • SaaS apps: a centered card with Google and GitHub buttons gets users signed in quickly
  • Admin panels: validated email and password fields with a show/hide toggle protect the back office
  • Member areas: a keep me signed in option saves returning users from logging in again
  • Keyboard-heavy users: a Caps Lock warning prevents failed password attempts

Accessibility

Every field has a visible label and the correct autocomplete value (username, current-password), so password managers work. Error messages are linked with aria-describedby only while a field is invalid, and the Caps Lock warning is linked while it is visible. The toggle button is a real button with aria-controls and aria-pressed. The success alert lives in a role="status" region, and during sign-in the submit button uses aria-disabled so focus stays on it. All controls show a clear blue focus outline.

Usage notes

Requires Bootstrap 5 and Bootstrap Icons. Client-side validation only helps users; always check the credentials on the server and protect the endpoint against brute-force attempts.

Centered Login Page at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons
Layout
Responsive, works on mobile
Category
Login Pages
License
Free for personal and commercial use

Questions about this template

Can I use the Centered Login Page code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Centered Login Page – free Bootstrap 5 login page template
Centered Login Page · free Bootstrap 5 login page template

More Login Pages

Glassmorphism Login Page over Photo – free Pure CSS login page template

Glassmorphism Login Page over Photo

Full-page login with a frosted glass card over a scenic lake photo, password reveal toggle, inline validation and a simulated sign-in state.

Login Page with Image Carousel Panel – free Bootstrap 5 login page template

Login Page with Image Carousel Panel

Bootstrap 5 split login page with a fading photo carousel, pause control, password toggle and simulated sign-in with validation.

Split Login Page – free Tailwind CSS login page template

Split Login Page

Split-screen Tailwind CSS login page with a violet brand panel, inline validation, show/hide password toggle and a loading state.