Bootstrap 5 Forms CSS: Mastering Styling & Layout

Ruth Jul 09, 2026

Bootstrap 5, the latest iteration of the popular CSS framework, brings a wealth of improvements and new features, with forms being one of the key areas that have seen significant enhancements. In this article, we'll delve into the world of Bootstrap 5 forms, exploring how to create responsive, stylish, and functional forms using CSS.

Best Free Bootstrap Login Forms ยป CSS Author
Best Free Bootstrap Login Forms ยป CSS Author

Before we dive into the specifics, let's briefly recap why Bootstrap is such a powerful tool for web developers. Bootstrap 5 offers a mobile-first approach, responsive design, and a vast array of pre-built components, including forms, that can save you time and effort. It also provides a consistent look and feel across different platforms and devices, ensuring your forms are accessible and user-friendly.

Free 22+ HTML5 Signup & Registration Forms - HTML, CSS
Free 22+ HTML5 Signup & Registration Forms - HTML, CSS

Getting Started with Bootstrap 5 Forms

To begin working with Bootstrap 5 forms, you'll first need to include the Bootstrap CSS and JavaScript files in your project. You can either download the files or use a CDN. Here's how to include them using a CDN:

HTML Form Validation with Bootstrap
HTML Form Validation with Bootstrap

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

Basic Form Structure

HTML Forms Cheat Sheet for Beginners โ€” Simple Guide
HTML Forms Cheat Sheet for Beginners โ€” Simple Guide

Bootstrap 5 forms are built using a grid system, with form controls and labels placed in columns. The basic structure of a Bootstrap form is as follows:

<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> <button type="submit" class="btn btn-primary">Submit</button> </form>

In this example, the `mb-3` class adds margin-bottom to the form group, `form-label` is used for the label, `form-control` for the input, and `btn` classes for the submit button.

bootstrap cheatsheet
bootstrap cheatsheet

Form Layouts

Bootstrap 5 offers several layout options for forms. You can create horizontal forms, inline forms, or even forms with floating labels. Here's an example of a horizontal form:

<form> <div class="row mb-3"> <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label> <div class="col-sm-10"> <input type="email" class="form-control" id="inputEmail3"> </div> </div> <button type="submit" class="btn btn-primary">Sign in</button> </form>

Multistep Responsive Form HTML5 CSS Boostrap 5 Template
Multistep Responsive Form HTML5 CSS Boostrap 5 Template

The `row` class is used to create a new row, and `col-sm-2` and `col-sm-10` classes are used to create columns for the label and input respectively.

Advanced Form Features

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Multistep Form HTML5 CSS Bootstrap5 Template
Multistep Form HTML5 CSS Bootstrap5 Template
๐Ÿ“ Create Forms in HTML
๐Ÿ“ Create Forms in HTML
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Website Landing Page using HTML CSS Bootstrap 5 #3
Website Landing Page using HTML CSS Bootstrap 5 #3
Bootstrap 5 Login Form Template
Bootstrap 5 Login Form Template
Bootstrap 5.3 (2025) Cheat Sheet
Bootstrap 5.3 (2025) Cheat Sheet
Html CSS Responsive Form Design With Full Code Free Template
Html CSS Responsive Form Design With Full Code Free Template
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
#CSS Animations Tips and Tricks
#CSS Animations Tips and Tricks
Bootstrap 5 Modal Login Form
Bootstrap 5 Modal Login Form
40 Best Free Inquiry Form Templates 2026 - Colorlib
40 Best Free Inquiry Form Templates 2026 - Colorlib
HTML Input Types : A Comprehensive Guide
HTML Input Types : A Comprehensive Guide
Css cheat sheet
Css cheat sheet
css border
css border
Log in Form design using HTML CSS || Bachelor BCA
Log in Form design using HTML CSS || Bachelor BCA
CSS Notes for Beginners (Easy + Quick Guide) ๐ŸŽจ
CSS Notes for Beginners (Easy + Quick Guide) ๐ŸŽจ
Css
Css
Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes
Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes
CSS Cheat Sheet for Beginners (Web Design Basics)
CSS Cheat Sheet for Beginners (Web Design Basics)

Bootstrap 5 also includes advanced features like form validation, input groups, and select menus. Let's explore these features briefly.

Form Validation

Bootstrap 5 provides built-in form validation using the `was-validated` class. When the form is submitted, Bootstrap adds the `is-invalid` class to any invalid fields, and the `is-valid` class to any valid fields. Here's an example:

<form class="was-validated"> <div class="mb-3"> <label for="validationCustom01" class="form-label">First name</label> <input type="text" class="form-control" id="validationCustom01" required> <div class="valid-feedback">Looks good!</div> </div> <button type="submit" class="btn btn-primary">Submit</button> </form>

The `required` attribute is used to mark the field as mandatory, and the `valid-feedback` and `invalid-feedback` classes are used to display custom feedback messages.

Input Groups

Input groups allow you to combine form controls and add-ons (like text or buttons) to create more complex inputs. Here's an example:

<div class="input-group mb-3"> <span class="input-group-text" id="basic-addon1">@</span> <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1"> </div>

The `input-group` class is used to create the input group, and the `input-group-text` class is used for the add-on.

In conclusion, Bootstrap 5 forms offer a wealth of features and customization options, allowing you to create responsive, stylish, and functional forms with ease. Whether you're a seasoned developer or just starting out, Bootstrap 5 has something to offer you. So why not dive in and start exploring the world of Bootstrap 5 forms today?