Add sizes for Bootstrap Buttons

Bootstrap provides several CSS classes to control button sizes, from large buttons to block-level buttons that span the full width of their container.

Button Size Classes

Class Description
.btn-lg Creates large buttons with increased padding and font size
.btn-sm Creates small buttons with reduced padding and font size
.btn-xs Creates extra small buttons (Bootstrap 3 only)
.btn-block Creates block-level buttons that span the full width of parent element

Example: Different Button Sizes

Here's how to implement buttons with different sizes using Bootstrap classes:

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Button Sizes</title>
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
   </head>
   <body>
      <div class="container mt-4">
         <!-- Large button -->
         <button type="button" class="btn btn-primary btn-lg">
            Large Button
         </button>
         
         <!-- Default size button -->
         <button type="button" class="btn btn-primary">
            Default Button
         </button>
         
         <!-- Small button -->
         <button type="button" class="btn btn-primary btn-sm">
            Small Button
         </button>
         
         <br><br>
         
         <!-- Block level button -->
         <button type="button" class="btn btn-success btn-block">
            Block Level Button
         </button>
      </div>
   </body>
</html>

Key Points

  • Size classes are additive: Combine with any button style class (btn-primary, btn-secondary, etc.)
  • Bootstrap 4 vs 3: The .btn-xs class was removed in Bootstrap 4
  • Block buttons: Use .btn-block for full-width buttons, useful for mobile layouts
  • Responsive design: Consider using different sizes for different screen sizes

Conclusion

Bootstrap's button size classes provide flexible options for creating buttons of different sizes. Use .btn-lg for emphasis, .btn-sm for compact interfaces, and .btn-block for full-width actions.

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

321 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements