Bootstrap Button Groups

Learn how to create Button Groups in Bootstrap and how to resize them. With that also learn how to vertically align buttons in a Button Group. The Button Groups are a series of buttons. The following are the Bootstrap classes to create a Button Group:

  • .btn-group: Create a Button Group.
  • .btn-group-vertical: Create a Vertical Button Group.
  • .btn-group-justified: To create a Button Group that spans the entire width of the screen.

The following are the Bootstrap class to create Button Group of different sizes:

  • .btn-group-lg: Large Button Group
  • .btn-group-sm: Small Button Group
  • .btn-group-xs: Extra Small Button Group

Example – Bootstrap Button Groups

Let us now see an example to create Button Groups in Bootstrap:

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Bootstrap Button Groups Examples</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</head>

<body>
    <div class="container">
        <h1>Bootstrap Button Groups</h1>
        <div class="btn-group btn-group-sm">
          <button type="button" class="btn btn-primary">Button1</button>
          <button type="button" class="btn btn-primary">Button2</button>
          <button type="button" class="btn btn-primary">Button3</button>
          <button type="button" class="btn btn-primary">Button4</button>
        </div>
	</div>
</body>

</html>

Output

Bootstrap Button Groups Example

Video Tutorial – Bootstrap Button Groups

The following is the complete video tutorial to learn how to work with Button Groups in Bootstrap:


If you liked the tutorial, spread the word and share the link and our website Studyopedia with others:


Read More:

Bootstrap Buttons
Bootstrap Responsive Tables
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment