Bootstrap 5, the latest version of the popular CSS framework, offers a wealth of tools for creating responsive and visually appealing login forms. If you're looking to create a user-friendly login page, Bootstrap 5 has you covered with its extensive collection of pre-built components and utilities. Let's explore some Bootstrap 5 login examples to help you get started.

Before diving into the examples, ensure you have the latest version of Bootstrap 5 installed. You can include it in your project using a CDN or download and host the files locally. Once you have Bootstrap 5 set up, you're ready to create stunning login forms.

Basic Bootstrap 5 Login Form
Let's start with a simple yet effective login form using Bootstrap 5's grid system and form controls.

First, include the necessary Bootstrap 5 CSS and JavaScript files. Then, create a container for your form using the `.container` class. Inside this container, use the `.row` and `.col` classes to structure your form elements.
Form Structure

Here's a basic example of a Bootstrap 5 login form structure:
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<form>
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" placeholder="Enter your username">
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" placeholder="Enter your password">
</div>
<button type="submit" class="btn btn-primary w-100">Login</button>
</form>
</div>
</div>
</div>
In this example, the form is centered using the `.justify-content-center` class on the `.row` element. The form elements are placed within a `.col-md-6` column to ensure responsiveness.
Styling the Form

To make your login form more appealing, you can add some styling using Bootstrap 5's utility classes and custom CSS. Here's an example of how you can style the basic login form:
<style>
.login-form {
background-color: #f8f9fa;
padding: 2rem;
border-radius: 0.5rem;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-form .form-label {
font-weight: bold;
}
.login-form .form-control {
border: none;
border-radius: 0;
border-bottom: 1px solid #ced4da;
padding: 0.5rem;
}
.login-form .form-control:focus {
border-color: #80bdff;
box-shadow: none;
}
.login-form .btn-primary {
background-color: #007bff;
border-color: #007bff;
}
.login-form .btn-primary:hover {
background-color: #0062cc;
border-color: #0062cc;
}
</style>
In this example, the form is given a background color, padding, border-radius, and box-shadow for a more polished look. The form labels are made bold, and the input fields have a border-bottom style with a focus indicator. Finally, the primary button is styled with a gradient effect on hover.
Responsive Login Form with Cards

Bootstrap 5's cards component can be used to create a more structured and visually appealing login form. Let's explore an example that uses cards for a responsive login form.
First, create a card using the `.card` class. Inside this card, place your login form using the same structure as the previous example. Then, use Bootstrap 5's responsive utility classes to make the form responsive.


















![50 Latest & Most Inspiring Login Page Examples and Responsive Templates [FREE DOWNLOAD, Updated 2025]](https://i.pinimg.com/originals/01/ea/5d/01ea5d6466e02290f46f83513e6254ef.png)

Form Structure with Cards
Here's an example of a login form using Bootstrap 5's cards component:
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-body">
<form>
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" placeholder="Enter your username">
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" placeholder="Enter your password">
</div>
<button type="submit" class="btn btn-primary w-100">Login</button>
</form>
</div>
</div>
</div>
</div>
</div>
In this example, the login form is placed inside a card with a `.card-body` class to provide some padding and separation from the card's border.
Styling the Form with Cards
To style the login form using cards, you can use Bootstrap 5's card utility classes and custom CSS. Here's an example of how you can style the login form with cards:
<style>
.login-form .card {
border: none;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-form .card-body {
padding: 2rem;
}
.login-form .form-label {
font-weight: bold;
}
.login-form .form-control {
border: none;
border-radius: 0;
border-bottom: 1px solid #ced4da;
padding: 0.5rem;
}
.login-form .form-control:focus {
border-color: #80bdff;
box-shadow: none;
}
.login-form .btn-primary {
background-color: #007bff;
border-color: #007bff;
}
.login-form .btn-primary:hover {
background-color: #0062cc;
border-color: #0062cc;
}
</style>
In this example, the card is styled with a border and box-shadow for a more polished look. The card body has some padding to separate the form elements from the card's border. The rest of the styling is the same as the previous example.
Login Form with Validation
Bootstrap 5 includes built-in validation styles and JavaScript plugins to help you create forms with real-time validation. Let's explore an example of a login form with validation using Bootstrap 5's form validation features.
First, include the Bootstrap 5 JavaScript file and the necessary JavaScript plugins for form validation. Then, add the `was-validated` class to your form to enable validation. Finally, add the `is-invalid` and `is-valid` classes to your input fields based on their validation status.
Form Structure with Validation
Here's an example of a login form with validation using Bootstrap 5:
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<form class="was-validated">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" placeholder="Enter your username" required>
<div class="invalid-feedback">Please enter your username.</div>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" placeholder="Enter your password" required>
<div class="invalid-feedback">Please enter your password.</div>
</div>
<button type="submit" class="btn btn-primary w-100">Login</button>
</form>
</div>
</div>
</div>
In this example, the `was-validated` class is added to the form to enable validation. The `required` attribute is added to the input fields to indicate that they are required. The `invalid-feedback` element is used to display an error message when the input field is invalid.
Styling the Form with Validation
Bootstrap 5 includes built-in styles for form validation. When an input field is invalid, it will be styled with a red border, and the error message will be displayed. There is no need for additional styling in this case.
In conclusion, Bootstrap 5 offers a wide range of tools for creating responsive and visually appealing login forms. By using its grid system, form controls, cards, and validation features, you can create stunning login forms that enhance the user experience. Start exploring these examples and building your own login forms today!