Set heights and widths of forms with Bootstrap

Bootstrap provides classes to control form element heights and widths. Use .input-lg, .input-sm for height sizing, and grid classes like .col-lg-* for width control.

Height Sizing Classes

Bootstrap offers three height sizes for form controls:

  • .input-lg - Large height input
  • Default - Standard height (no class needed)
  • .input-sm - Small height input

Width Control with Grid System

Use Bootstrap's grid classes to control form element widths. Wrap inputs in .row and use column classes like .col-lg-2, .col-lg-3, etc.

Example

Here's how to implement different form sizes:

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Form Sizing</title>
      <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <script src="/scripts/jquery.min.js"></script>
      <script src="/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class="container">
         <h3>Form Height Sizing</h3>
         <form role="form">
            <div class="form-group">
               <input class="form-control input-lg" type="text" placeholder="Large input (.input-lg)">
            </div>
            <div class="form-group">
               <input class="form-control" type="text" placeholder="Default input">
            </div>
            <div class="form-group">
               <input class="form-control input-sm" type="text" placeholder="Small input (.input-sm)">
            </div>

            <h4>Select Elements</h4>
            <div class="form-group">
               <select class="form-control input-lg">
                  <option value="">Large select (.input-lg)</option>
               </select>
            </div>
            <div class="form-group">
               <select class="form-control">
                  <option value="">Default select</option>
               </select>
            </div>
            <div class="form-group">
               <select class="form-control input-sm">
                  <option value="">Small select (.input-sm)</option>
               </select>
            </div>

            <h4>Width Control with Grid System</h4>
            <div class="row">
               <div class="col-lg-2">
                  <input type="text" class="form-control" placeholder=".col-lg-2">
               </div>
               <div class="col-lg-3">
                  <input type="text" class="form-control" placeholder=".col-lg-3">
               </div>
               <div class="col-lg-4">
                  <input type="text" class="form-control" placeholder=".col-lg-4">
               </div>
            </div>
         </form>
      </div>
   </body>
</html>

Key Points

  • Height classes (.input-lg, .input-sm) work with inputs, selects, and textareas
  • Grid classes control width and must be wrapped in a .row container
  • Combine height and width classes for precise control
  • All sizing classes work with .form-control

Conclusion

Bootstrap's sizing classes provide flexible form control over dimensions. Use .input-lg/.input-sm for height and grid classes for responsive width control.

Updated on: 2026-03-15T23:18:59+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements