Web forms are the primary bridge between users and web applications: handling registrations, logins, payment processing, searches, and feedback. In Bootstrap 5, form styles were completely redesigned with pure custom CSS (no vendor-specific hacky wrappers) to provide identical visual rendering and accessibility across Chrome, Safari, Firefox, Edge, iOS, and Android.
.form-control & .form-label)Style text inputs, password fields, email inputs, and textareas with .form-control, paired with .form-label for descriptive headings:
<form class="card p-4 shadow-sm">
<div class="mb-3">
<label for="exampleEmail" class="form-label">Email Address</label>
<input type="email" class="form-control" id="exampleEmail" placeholder="student@veewom.com" aria-describedby="emailHelp">
<div id="emailHelp" class="form-text">We will never share your email with third parties.</div>
</div>
<div class="mb-3">
<label for="examplePassword" class="form-label">Password</label>
<input type="password" class="form-control" id="examplePassword">
</div>
<div class="mb-3">
<label for="userBio" class="form-label">Your Bio / Comments</label>
<textarea class="form-control" id="userBio" rows="3"></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit Form</button>
</form>
.form-check)Bootstrap 5 replaces clunky default operating system checkboxes and radios with sleek, custom vector SVG checkmarks and radio dots:
<!-- Checkboxes -->
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" value="newsletter" id="checkNewsletter" checked>
<label class="form-check-label" for="checkNewsletter">
Subscribe to Weekly Tech Newsletter
</label>
</div>
<!-- Radio Buttons (Share same name attribute for single choice) -->
<div class="form-check">
<input class="form-check-input" type="radio" name="planChoice" id="planFree" checked>
<label class="form-check-label" for="planFree">Free Student Tier</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="planChoice" id="planPro">
<label class="form-check-label" for="planPro">Pro Masterclass Tier</label>
</div>
.form-switch)Create modern smartphone-style toggle switches simply by adding the .form-switch class to your .form-check container:
<!-- Toggle Switch -->
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" role="switch" id="switchDarkMode">
<label class="form-check-label" for="switchDarkMode">Enable Dark Theme Mode</label>
</div>
Add the disabled or readonly boolean attribute to prevent user input while maintaining accessible contrast:
<input class="form-control mb-2" type="text" placeholder="Disabled Input" disabled>
<input class="form-control" type="text" value="Readonly User ID: #9842" readonly>
Always match the for attribute on <label> with the id of the <input>. This allows screen readers to announce the label when the input receives focus, and enables users to click on the label text to activate checkboxes or focus inputs!
Strengthen your responsive web design mastery by studying these connected classes:
Upgrade standard form inputs to modern material-style floating labels.
Customize drop-down selects and interactive HTML5 range sliders.
Prepend and append icons, currency symbols, and buttons to input fields.
Implement HTML5 constraint validation with instant green/red feedback.
disabled input is grayed out, cannot receive focus, and its value is NOT submitted with the form. A readonly input cannot be edited by the user, but it CAN receive focus, and its value IS submitted with the form data.
.form-control-lg for larger inputs (great for login pages) or .form-control-sm for compact data entry forms.
.form-check-inline class to your .form-check containers.
Advance your practical frontend engineering skills with the next topic in our synchronized curriculum.
Continue to Class 14: Select Menus & Range → Previous: ← Class 12: Buttons & Button Groups | Full Syllabus