Bootstrap 5 Login Form Example

Ruth Jul 09, 2026

Bootstrap, the popular open-source CSS framework, has evolved significantly over the years, and with it, so have its form components. In this article, we'll delve into creating a login form using the latest version, Bootstrap 5. We'll explore the new features, syntax, and best practices to help you build responsive and stylish login forms.

Best Free Bootstrap Login Forms » CSS Author
Best Free Bootstrap Login Forms » CSS Author

Before we dive into the code, let's briefly discuss why Bootstrap 5 is a great choice for building web forms. Bootstrap 5 offers a mobile-first approach, responsive design, and a consistent look and feel across different platforms. It also provides a rich set of pre-built components and utilities that can speed up your development process.

Bootstrap 5 Login Form Template
Bootstrap 5 Login Form Template

Setting Up Bootstrap 5

To start using Bootstrap 5 in your project, you'll first need to include it in your HTML file. You can either download the files from the official Bootstrap website or use a CDN (Content Delivery Network). Here's how you can include Bootstrap 5 using a CDN:

40 Best Free Bootstrap Login Form Templates 2026 - Colorlib
40 Best Free Bootstrap Login Form Templates 2026 - Colorlib

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKqhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">

Understanding Bootstrap 5's New Grid System

Login Form Template Bootstrap 5
Login Form Template Bootstrap 5

Bootstrap 5 introduces a new, more flexible grid system. It uses a single container class and a new row class with automatic column sizing. To create a simple login form, we'll use the new grid system to layout our form elements.

Here's a basic example of how to create a grid layout for our login form:

<div class="container"> <div class="row"> <div class="col-md-6">...</div> <div class="col-md-6">...</div> </div> </div>

Bootstrap 5 popup form
Bootstrap 5 popup form

Creating the Login Form

Now that we've set up our grid, let's create the actual login form. In Bootstrap 5, form controls are built with classes like form-control for inputs and form-select for select elements. Here's a simple login form example:

<form> <div class="mb-3"> <label for="exampleInputEmail1" class="form-label">Email address</label> <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"> <div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div> </div> <div class="mb-3"> <label for="exampleInputPassword1" class="form-label">Password</label> <input type="password" class="form-control" id="exampleInputPassword1"> </div> <button type="submit" class="btn btn-primary">Submit</button> </form>

three screens showing the user's avatars for bootstrap 4, with mountains in the background
three screens showing the user's avatars for bootstrap 4, with mountains in the background

Styling the Login Form

Bootstrap 5 offers a wide range of utility classes that can help you style your form quickly. You can use these classes to change the background color, text color, border radius, and more. Here's how you can style our login form using utility classes:

Sign in & Sign up in one page with Luxury Design
Sign in & Sign up in one page with Luxury Design
the login screen for an email address
the login screen for an email address
37 Free Bootstrap Form Templates You Can Try Right Now
37 Free Bootstrap Form Templates You Can Try Right Now
Bootstrap Responsive Design Registration Form
Bootstrap Responsive Design Registration Form
the gratify login screen is shown in this screenshote image, it appears to be dark blue
the gratify login screen is shown in this screenshote image, it appears to be dark blue
the bootstap login and register forms page
the bootstap login and register forms page
Login page through HTML and CSS
Login page through HTML and CSS
FORM connect bootstrap
FORM connect bootstrap
Login Form 11 by Colorlib - Free HTML Login Form 2026 - Colorlib
Login Form 11 by Colorlib - Free HTML Login Form 2026 - Colorlib
Webflow Login Form With Google Auth for Webflow
Webflow Login Form With Google Auth for Webflow
Interactive login/signup design - Manish Kumar
Interactive login/signup design - Manish Kumar
Bootstrap 5 Modal Login Form
Bootstrap 5 Modal Login Form
the sign in page for a website
the sign in page for a website
Simple Login Form Free Responsive Widget Template | ThemeVault | ThemeVault
Simple Login Form Free Responsive Widget Template | ThemeVault | ThemeVault
How To Make A Website With Login And Register | HTML CSS & Javascript
How To Make A Website With Login And Register | HTML CSS & Javascript
a screen shot of the login page for an email form with a hand holding a dollar sign
a screen shot of the login page for an email form with a hand holding a dollar sign
40 Best Free Bootstrap Login Form Templates 2026 - Colorlib
40 Best Free Bootstrap Login Form Templates 2026 - Colorlib
Responsive Login Form with Toggle Password Visibility (HTML CSS JavaScript)
Responsive Login Form with Toggle Password Visibility (HTML CSS JavaScript)
a green login form on a computer screen
a green login form on a computer screen
the login page for an app with blue and white shapes
the login page for an app with blue and white shapes

<form class="bg-light p-5 rounded"> ... </form>

Responsive Design

Bootstrap 5's grid system ensures that your form will look good on all screen sizes. However, you can further customize the responsiveness of your form using the responsive utility classes. For example, you can use the d-none class to hide an element on small screens:

<button type="submit" class="btn btn-primary d-none d-sm-block">Submit</button>

Validation

Bootstrap 5 also includes built-in form validation. You can use the is-valid and is-invalid classes to provide visual feedback to the user. Here's how you can validate the email input field:

<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" required>

And that's it! You've now created a responsive and stylish login form using Bootstrap 5. As you continue to explore Bootstrap 5, you'll find that it offers many more features and components that can help you build powerful web applications.

Now that you've seen how easy it is to create a login form with Bootstrap 5, why not explore other form components like inputs, selects, checkboxes, and radios? You can also delve into Bootstrap 5's new customization options to create a truly unique form.