Create a button group

Description: Make one group of three outline buttons (Left, Middle, Right), and a vertical group of two buttons.

Hint:

  • Use btn-group and btn-group-vertical.

Solution

<div class="btn-group mb-3" role="group" aria-label="Alignment">
  <button type="button" class="btn btn-outline-primary">Left</button>
  <button type="button" class="btn btn-outline-primary">Middle</button>
  <button type="button" class="btn btn-outline-primary">Right</button>
</div>
<br>
<div class="btn-group-vertical" role="group" aria-label="Vertical group">
  <button type="button" class="btn btn-secondary">Top</button>
  <button type="button" class="btn btn-secondary">Bottom</button>
</div>
Live preview

How it works

  • btn-group joins the buttons and removes the space and the inner radius.

Read Buttons.


Learn more about the similar topics:
Tutorials
Bootstrap Buttons
Bootstrap Alerts
Bootstrap Badges
Bootstrap Cards
Bootstrap List Group
Bootstrap Progress Bars and Spinners
Bootstrap Icons
Exercises & Assignments
Create a card with an image, a title, a text and a button
Create an alert which the user can close
Create a progress bar at 60 percent
Create a pricing section with three cards
Create a button group
Add a notification count badge to a button
Create a hero section with a heading and two buttons
Interview Questions & Answers
How do you create buttons in Bootstrap?
How do you make a full width button in Bootstrap 5?
What are Bootstrap alerts and how do you close them?
What is a card in Bootstrap?
How do you use Bootstrap Icons?
How do you make cards of equal height in Bootstrap?