agyanadda@gmail.com

Bootstrap Forms

Bootstrap Forms 1 min read Updated Dec 1, 2026 Topic 26 of 32

Bootstrap styles every form control consistently.

Main classes

Element Class
<label> form-label
text inputs, textarea form-control
<select> form-select
checkbox / radio wrapper form-check
checkbox / radio input form-check-input
checkbox / radio label form-check-label
toggle switch form-check form-switch
range slider form-range
small help text form-text

Sizes

form-control-lg, form-control-sm (and form-select-lg…)

Layout

  • Space between fields: mb-3 on each group
  • Side-by-side fields: use the grid, row g-3 with col-md-6
  • Inline radios: form-check-inline

Always connect labels to inputs with for and id — it helps accessibility and makes the label clickable.

Example

Example — Admission form HTML
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">

<div class="container my-3" style="max-width: 640px;">
  <form class="row g-3">
    <div class="col-md-6">
      <label for="fname" class="form-label">Full name</label>
      <input type="text" class="form-control" id="fname" placeholder="Asha Kumari">
    </div>
    <div class="col-md-6">
      <label for="mobile" class="form-label">Mobile</label>
      <input type="tel" class="form-control" id="mobile" placeholder="98xxxxxxxx">
    </div>
    <div class="col-md-6">
      <label for="course" class="form-label">Course</label>
      <select id="course" class="form-select">
        <option selected>Choose...</option>
        <option>Web Development</option>
        <option>Python</option>
      </select>
    </div>
    <div class="col-md-6">
      <label class="form-label d-block">Batch</label>
      <div class="form-check form-check-inline"><input class="form-check-input" type="radio" name="batch" id="b1" checked><label class="form-check-label" for="b1">Morning</label></div>
      <div class="form-check form-check-inline"><input class="form-check-input" type="radio" name="batch" id="b2"><label class="form-check-label" for="b2">Evening</label></div>
    </div>
    <div class="col-12">
      <label for="msg" class="form-label">Message</label>
      <textarea class="form-control" id="msg" rows="3"></textarea>
      <div class="form-text">We reply within one working day.</div>
    </div>
    <div class="col-12">
      <div class="form-check form-switch"><input class="form-check-input" type="checkbox" id="wa" checked><label class="form-check-label" for="wa">Send updates on WhatsApp</label></div>
    </div>
    <div class="col-12"><button type="submit" class="btn btn-primary">Apply now</button></div>
  </form>
</div>

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which class styles a select dropdown?

Exercise 2 Fill in the Blank

Add form-check form-___ to turn a checkbox into a toggle switch.

Exercise 3 True / False

The grid can be used to place form fields side by side.

Frequently Asked Questions

Add the readonly or disabled attribute to the input. Bootstrap styles both automatically.