Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Explore Bootstrap buttons and Bootstrap badges in this Bootstrap tutorial II. Learn to create visually alluring websites.
Mbaziira Ronald
December 28, 2025
In the dynamic world of web development, where every click, tap, and interaction matters, one cannot emphasize the prominence of UI components enough. Of these UI components, buttons and badges are some of the unsung heroes of user experience.
From guiding visitors through websites with a silent persuasiveness that ensures smooth interaction and navigation, buttons, and badges also bridge the gap between functionality and aesthetics.
By strategically placing buttons and badges in well-thought-out locations, web designers wield the power to enhance usability, boost conversions, and give users a sense of control as they traverse the digital landscape.
Unsurprisingly, websites such as YouTube, Amazon, Samsung, and X (formerly Twitter) utilize these UI components for displaying status indicators, facilitating navigation, and serving as Call-To-Action (CTA) elements.

Amazon uses a badge to indicate to customers the products with the highest sales in different categories. In the image above, the badge Best Seller indicates Apple Pencil and Apple 2020 Macbook Air Laptop M1 as the best sellers in the Styluses and Computer and Accessories categories. The badge helps customers to decisively and quickly make better purchases.
Netflix uses a button to collect emails for new membership accounts, as the image below shows. The button acts as a Call-To-Action (CTA), guiding users and eliminating confusion and hesitation by providing a straightforward way to proceed.

And for Netflix, the prominent button minimizes user drop-offs during the subscription. This streamlining enhances user experience and leads to higher conversion rates.
In the Bootstrap tutorial Part I, we saw Bootstrap dropdowns and collapse. Building upon the knowledge gained from the first tutorial, let’s dive deeper into this versatile front-end toolkit.
This Bootstrap tutorial Part II will explore how Bootstrap buttons and Bootstrap badges work, their advanced features, and how to test their responsiveness on different devices. Bootstrap is a free and open-source front-end toolkit with a set of reusable pre-built styles, classes, and components.
Let’s look at Bootstrap buttons and Bootstrap badges from an outside-the-box perspective before diving deeper into their inner workings.
You can use Bootstrap badges as tags, labels, or status indicators. The size of the badges primarily depends on the size of their parent wrapper.
Some real-life examples of websites demonstrate how buttons and badges can be used in modern web design. These examples encompass two categories:
Note: Test your Bootstrap buttons and badges on real devices. Try TestMu AI Today!
Button components are some of the most common ones found on websites, thanks to their many uses. Badges have become more prevalent in web development, though not as common. The points below explore the importance of buttons and badges in web development.
Let’s look at some areas where badges are prevalent in web development.
One of the major areas where badges have found widespread use is notifications. Badges usually show the number of unread messages, missed calls, or todos you have in a specific application.
The image below shows how X (formerly Twitter) uses a badge to indicate the number of notifications in the upper right corner of the bell icon.

Have you ever seen a blog article card on a website’s blog page with the badge Featured or Trending? It is now a web development trend to label blog cards to distinguish them from the rest to attract the viewer’s attention.
In the below example, Hashnode uses a badge to show you articles it is featuring on the platform.

As you can see below, TestMu AI enhances user awareness by incorporating badges onto the blog cards, effectively informing readers about the specific number of chapters contained within each blog article.

Bootstrap has several utility classes to work with buttons, from styling and sizing the buttons to grouping and deactivating their functionality. Below are some of the classes for Bootstrap button:
| Variants | Grouping | Size |
|---|---|---|
| btn-primary | btn-group | btn-lg |
| btn-success | btn-toolbar | btn-sm |
| btn-warning |
You can use other HTML elements as buttons in Bootstrap, such as the < a > and < input > elements.
<a class="btn btn-light border" href="#" role="button">Book a Testing Demo</a>
<input class="btn btn-primary" type="button" value="More on LT Browser">
The btn class defines the basic styling for an element you want to use as a button in Bootstrap. It defines padding, content alignment, transparent border, and background for that element.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="./node_modules/bootstrap/dist/css/bootstrap.min.css"
/>
<title>Bootstrap CSS Buttons - The btn class</title>
</head>
<body class="py-5 bg-light">
<div class="container">
<button class="btn">Explore Selenium testing</button>
<button class="btn">Explore Cypress testing</button>
<button class="btn">Explore Playwright testing</button>
</div>
<script src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Browser output:

From the preview above, the btn class has set a transparent background, border color, and padding for our button elements.
Bootstrap badges are visual indicators that display information, status, or context on the progress or development of an activity or application. Bootstrap badges have several uses, such as notifications and labels.
The example below shows how Samsung uses the NEW badge to indicate the latest products in the New Featured menu dropdown section.


The example below shows how YouTube uses a LIVE badge to indicate the channels airing live at that time.


To create a Bootstrap badge, you can use the class badge, followed by a contextual background color to convey its meaning well. Badge sizes match their immediate parent’s size using relative font sizing and em units.
One of the primary ways of making Bootstrap badges is using HTML headings, which are hierarchical with varying font sizes.
Let’s see how you can create Bootstrap badges based on headings as their parents.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="./node_modules/bootstrap/dist/css/bootstrap.min.css"
/>
<title>Bootstrap CSS Tables - Badges based on headings</title>
</head>
<body class="py-5 bg-light">
<div class="container">
<div class="mb-3">
<p class="fw-medium fs-3">Badges based on headings</p>
<span class="text-secondary">
Badges inheriting the sizes of headings
</span>
</div>
<h1>
Heading 1
<span class="badge bg-primary">1</span>
</h1>
<h2>
Heading 2
<span class="badge bg-warning">2</span>
</h2>
<h3>
Heading 3
<span class="badge bg-danger">3</span>
</h3>
<h4>
Heading 4
<span class="badge bg-success">4</span>
</h4>
<h5>
Heading 5
<span class="badge bg-secondary">5</span>
</h5>
<h6>
Heading 6
<span class="badge bg-info">6</span>
</h6>
</div>
<script src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Browser output:

In the browser output above, we can see that the size of each badge is based on the font size of its parent, in this case, the headings.
Pill badges resemble pills due to their shape, hence the name pill badges. You can create pill badges by adding the class rounded-pill to any badge.
GitHub uses pill badges as tags to indicate which repositories are public and private.

Etsy uses pill badges as indicators of products with free shipping in its store. Bootstrap pill badges are a specific type of badge used in web development to provide visual cues and notifications.

Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="./node_modules/bootstrap/dist/css/bootstrap.min.css"
/>
<title>
Bootstrap CSS Tables - Pill badges
</title>
</head>
<body class="py-4 bg-light">
<div class="container">
<h1 class="fw-medium fs-4">Pill badges</h1>
<!-- Pill badges -->
<div class="mt-4">
<span class="badge rounded-pill bg-primary px-4 py-2 fs-6 mb-3">New notifications</span>
<br>
<span class="badge rounded-pill bg-warning px-4 py-2 fs-6 mb-3">Warnings found!</span>
<br>
<span class="badge rounded-pill bg-danger px-4 py-2 fs-6 mb-3">Check errors</span>
<br>
<span class="badge rounded-pill bg-info px-4 py-2 fs-6 mb-3">Funds on hold</span>
<br>
<span class="badge rounded-pill bg-warning px-4 py-2 fs-6 mb-3">Attention required!</span>
<br>
<span class="badge rounded-pill bg-success px-4 py-2 fs-6">Account deleted successfully</span>
</div>
</div>
<script src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Browser output:

In several real-world applications, badges are usually in the corners of their parent containers. There are multiple reasons for this, including:
The example below shows how TestMu AI Customer Support uses the badge in the corner of the chat icon to start or respond to an ongoing conversation and also easily notify the user of new messages due to its noticeability.


Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="./node_modules/bootstrap/dist/css/bootstrap.min.css"
/>
<title>Bootstrap CSS Tables - Positioning badges</title>
</head>
<body class="py-4 bg-light">
<div class="container">
<h1 class="fw-medium fs-4">Positioning badges</h1>
<!-- Buttons with badges -->
<div class="mt-5">
<button class="btn rounded-pill position-relative bg-primary text-white px-4 py-2 fs-5 mb-4">
Notifications <span class="badge bg-secondary top-0 start-100 position-absolute translate-middle">+20</span>
</button>
<br>
<button class="btn position-relative bg-success text-white px-4 py-2 fs-5 mb-4">
Transactions completed <span class="badge bg-warning top-0 start-100 position-absolute translate-middle">7</span>
</button>
<br>
<button type="button" class="btn btn-primary position-relative">
Online <span class="position-absolute top-0 start-100 translate-middle badge border border-light rounded-circle bg-success p-2"><span></span></span>
</button>
</div>
</div>
<script src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Browser output:

In the above browser output, all the Bootstrap badges are positioned in the corners of their parents’ buttons using Bootstrap’s position utility.
The Bootstrap buttons are given a position relative, and the badges are absolute. The badges are then pushed 100px from the left to the right and 0px from the top, thus forcing them into the upper right corner of the buttons.
In this section, we will look at Button toolbars, one of the advanced features you can create with Bootstrap buttons.
Button toolbars, as seen earlier, are groups of sets of button groups. Button toolbars enable you to group and present related elements or actions together. For this example, we will create a page with a button toolbar consisting of TestMu AI’s Webinars.
Code:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Toolbars for pagination</title>
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css">
<style>
body::before {
display: block;
content: '';
height: 90px;
}
.card-img {
width: 350px;
height: auto;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg bg-white py-4 fixed-top">
<div id="logo" class="container ms-auto">
<a class="navbar-brand" href="#">
<img src="https://www.lambdatest.com/resources/images/logos/logo.svg" alt="LambdaTest Logo" />
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbar-menu">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a href="#" class="nav-link">Platform</a></li>
<li class="nav-item"><a href="#" class="nav-link">Enterprise</a></li>
<li class="nav-item"><a href="#" class="nav-link">Resources</a></li>
<li class="nav-item"><a href="#" class="nav-link">Developers</a></li>
<li class="nav-item"><a href="#" class="nav-link">Pricing</a></li>
<li class="d-flex gap-3 ms-lg-4 ms-md-0 ms-sm-0">
<a href="" class="nav-link">Login</a>
<button class="btn btn-outline-dark" data-bs-toggle="modal" data-bs-target="#bookdemo" type="button">
Book a Demo
</button>
<a class="btn btn-dark" href="#" role="button">Sign Up</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Page heading and description -->
<section class="bg-primary-subtle text-center pt-5 pb-4">
<div class="container">
<h2>LAMBDATEST WEBINARS</h2>
<p class="text-secondary">Learn more on how you can leverage LambdaTest for your manual and automation testing needs.</p>
</div>
</section>
<!-- Webinars -->
<section class="bg-white py-5">
<div class="container">
<!-- Cards container -->
<div class="row row-cols-1 gap-5">
<!-- card 1 -->
<div class="bg-light rounded-4 px-3">
<div class="d-flex py-5 px-4 align-items-center gap-5">
<div class="d-none d-sm-none d-md-none d-xl-inline-flex d-xxl-inline-flex">
<a href="https://www.lambdatest.com/webinar/my-favorite-cypress-plugins">
<img src="https://www.lambdatest.com/resources/images/webinar/my-favorite-cypress-plugins-meta2.png" alt="my-favorite-cypress-plugins" class="card-img">
</a>
</div>
<div class="align-self-start">
<div>
<a class="fs-4 fw-semibold link-dark link-underline link-underline-opacity-0 link-underline-opacity-75-hover">My Favorite Cypress Plugins</a>
<p class="text-secondary">In this webinar, Dr. Gleb Bahmutov delves deep into the fascinating realm of Cypress plugins.</p>
</div>
<div class="d-flex gap-3 text-secondary">
<p>21 JUNE 2023</p>
<p class="">65 mins</p>
</div>
</div>
</div>
</div>
<!-- Card 2 -->
<div class="bg-light rounded-4 px-3">
<div class="d-flex py-5 px-4 align-items-center gap-5">
<div class="d-none d-sm-none d-md-none d-xl-inline-flex d-xxl-inline-flex">
<a href="https://www.lambdatest.com/webinar/my-favorite-cypress-plugins">
<img src="https://www.lambdatest.com/resources/images/webinar/digital-accessibility-testing-meta2.png" alt="my-favorite-cypress-plugins" class="card-img">
</a>
</div>
<div class="align-self-start">
<div>
<a class="fs-4 fw-semibold link-dark link-underline link-underline-opacity-0 link-underline-opacity-75-hover">Digital Accessibility Testing: How To Get It Right</a>
<p class="text-secondary">
In this webinar, Tamar Schapira delves into the world of 'Digital Accessibility
<!-- </br> --> Testing' and reveal the secrets to ensure a seamless user experience for all.
</p>
</div>
<div class="d-flex gap-3 text-secondary">
<p>31 MAY 2023</p>
<p class="">62 mins</p>
</div>
</div>
</div>
</div>
<!-- Card 3 -->
<div class="bg-light rounded-4 px-3">
<div class="d-flex py-5 px-4 align-items-center gap-5">
<div class="d-none d-sm-none d-md-none d-xl-inline-flex d-xxl-inline-flex">
<a href="https://www.lambdatest.com/webinar/my-favorite-cypress-plugins">
<img src="https://www.lambdatest.com/resources/images/webinar/playwright-meta.png" alt="my-favorite-cypress-plugins" class="card-img">
</a>
</div>
<div class="align-self-start">
<div>
<a class="fs-4 fw-semibold link-dark link-underline link-underline-opacity-0 link-underline-opacity-75-hover">The 'New Tool On The Block' Playwright'</a>
<p class="text-secondary">
In this webinar, Butch Mayhew shared his learning journey in building automated tests with Playwright.
</p>
</div>
<div class="d-flex gap-3 text-secondary">
<p>26 APRIL 2023</p>
<p class="">63 mins</p>
</div>
</div>
</div>
</div>
<!-- Card 4 -->
<div class="bg-light rounded-4 px-3">
<div class="d-flex py-5 px-4 align-items-center gap-5">
<div class="d-none d-sm-none d-md-none d-xl-inline-flex d-xxl-inline-flex">
<a href="https://www.lambdatest.com/webinar/my-favorite-cypress-plugins">
<img src="https://www.lambdatest.com/resources/images/webinar/cleancoding2.png" alt="my-favorite-cypress-plugins" class="card-img">
</a>
</div>
<div class="align-self-start">
<div>
<a class="fs-4 fw-semibold link-dark link-underline link-underline-opacity-0 link-underline-opacity-75-hover">Clean Coding Practices for Test Automation: Part 2</a>
<br class="text-secondary">
In this webinar, we learned about the clean coding practices with real-world scenarios and showcased the implementation of various design patterns.
</p>
</div>
<div class="d-flex gap-3 text-secondary">
<p>23 MARCH 2023</p>
<p class="">94 mins</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Toolbars -->
<section class="text-center">
<div class="btn-tooblar mb-5">
<a class="me-3 link-info" href="#">Previous</a>
<!-- Button group 1 -->
<div class="btn-group me-3 d-none d-sm-inline-flex d-md-inline-flex d-xl-inline-flex d-xxl-inline-flex">
<button class="btn btn-outline-info">1</button>
<button class="btn btn-outline-info">2</button>
<button class="btn btn-outline-info">3</button>
<button class="btn btn-outline-info">4</button>
</div>
<!-- Button group 2 -->
<div class="btn-group me-3">
<button class="btn btn-outline-info">5</button>
<button class="btn btn-info">6</button>
<button class="btn btn-outline-info">7</button>
<button class="btn btn-outline-info">8</button>
</div>
<!-- Button group 3 -->
<div class="btn-group me-3 d-none d-sm-none d-md-inline-flex d-xl-inline-flex d-xxl-inline-flex">
<button class="btn btn-outline-info">9</button>
<button class="btn btn-outline-info">10</button>
<button class="btn btn-outline-info">11</button>
<button class="btn btn-outline-info">12</button>
</div>
<a href="#" class="link-info">Next</a>
</div>
</section>
<script src="./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Browser output:
Browsers and devices have made significant strides in improving their compatibility with CSS properties and standards. However, despite these advancements, there are still some irregular discrepancies due to the evolving nature of CSS and the diversity of browsers and devices.
We will look at some common issues and how you can fix them.
You can make your website’s buttons accessible first by using semantic HTML, and WAI-ARIA attributes like role. Additionally, you can carry out accessibility testing to ensure that your site is accessible across different operating systems and browsers.
The code below demonstrates how to use the ARIA role to indicate a link functioning as a button.
<a class="btn btn-primary disabled" role="button" href="#">Read more on Accessibility testing</a>
Ensuring the responsiveness of your website is vital. It becomes even more critical when it comes to buttons and badges due to the crucial role they play. On smaller screens like mobile phones, non-responsive buttons could lead to missed clicks, misclicks, or an inability to interact with essential CTAs such as making purchases or submitting a form.
To counter this, you can carry out responsive testing using tools like LT Browser on 50+ screen resolutions to know the behavior of the buttons on different devices viewports. Also, you can use the Bootstrap classes btn-lg and btn-sm to increase or decrease the size of the buttons.
You can ensure the responsiveness of your website by carrying out responsive testing. It helps you know how your buttons, badges, and website behave on different devices and browsers.
We’ll evaluate the responsiveness of the button toolbar of TestMu AI’s webinar page on LT Browser, which we’ve designed on CodePen. We will test it on mobile, tablet, and desktop viewports.
Mobile Preview:

Tablet Preview:

Desktop Preview:

You can ensure browser compatibility by carrying out browser testing both manually and automatically using cloud-based testing platforms like TestMu AI.
TestMu AI is an AI-powered test orchestration and execution platform that lets you perform manual and automated tests at scale on over 3000+ real browsers, devices, and platforms. It will help you know which Bootstrap features are suitable for your users’ browsers so that you can quickly respond accordingly.
You can test browser compatibility of your Bootstrap features (in this case, Bootstrap buttons and Bootstrap badges) on the latest and legacy web browsers like Chrome, Firefox, and Edge. You can even test on Safari on the latest macOS Sonoma.
Note: Perform browser testing on real Windows & macOS. Try TestMu AI Today!
We have journeyed through the various aspects of Bootstrap buttons and badges. We have explored their multiple uses and responsive design capabilities and their integral part in web development.
However, the journey doesn’t end here. The innovation potential is limitless. Thus, I urge you to explore new possibilities continuously.
Thank you for taking the time to read this Bootstrap tutorial II and reaching this far. See you in the next one!
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance