Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11In Bootstrap 5.3, create a button by pairing .btn with a variant such as .btn-primary; create a badge with .badge and a color helper such as .text-bg-secondary. Use a native <button> for an action and an <a> for navigation. The examples below use Bootstrap 5.3 conventions—match the code to the version your project loads.
Load Bootstrap 5.3
If Bootstrap is already included in your project, skip this setup and use the classes below. Otherwise, the official Bootstrap 5.3 getting-started guide covers CDN and package-manager installation, among other setup options. Its CDN examples showed version 5.3.8 when checked on October 3, 2026; use the version appropriate to your project rather than mixing version-specific examples.
For a quick standalone demonstration, add the Bootstrap stylesheet in the document head and its JavaScript bundle before the closing body tag. The buttons and badges in this guide are styled by the CSS; the JavaScript bundle is not required just to display them.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet">
<title>Buttons and badges</title>
</head>
<body>
<main class="container py-4">
<button type="button" class="btn btn-primary">Save changes</button>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Create a basic Bootstrap button
The base class is .btn. Add a variant class to apply the button’s visual treatment:
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
<button type="button" class="btn btn-primary">Save changes</button>
Bootstrap documents these variants: .btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-warning, .btn-info, .btn-light, .btn-dark, and .btn-link. Choose a variant to suit the interface, but put the action’s meaning in its text too: color by itself may not communicate the purpose to people who cannot distinguish the colors. See Bootstrap’s Buttons documentation for the documented variants and examples.
Choose the element for its behavior
- Use
<button>for an action, such as submitting a form or opening a dialog. - Use
<a href="...">when the control navigates to a destination. Bootstrap styles anchors with button classes too. - Bootstrap can also style input elements. Choose the input type and markup to match the control’s actual purpose.
If an anchor triggers an in-page action instead of navigating, add role="button" so its role is communicated appropriately. The class .btn on its own does not provide explicit hover and focus styling; pair it with a variant or supply your own focus and hover styles.
Make a button outlined, smaller, or full width
Use an outline variant
Replace a solid variant with its outline counterpart when you want less visual emphasis:
<button type="button" class="btn btn-outline-primary">Learn more</button>
Outline variants use the .btn-outline-* pattern. Check the actual foreground and background colors in your page: some light treatments may need a dark background to remain legible.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use a built-in size or adjust locally
Add .btn-lg for a larger button or .btn-sm for a smaller one:
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
<button type="button" class="btn btn-primary btn-sm">Edit</button>
<button type="button" class="btn btn-primary btn-lg">Continue</button>
For a custom size, set Bootstrap’s button CSS variables on the button rather than changing every button in the project:
<button type="button" class="btn btn-primary" style="--bs-btn-padding-y: .6rem; --bs-btn-padding-x: 1.25rem; --bs-btn-font-size: 1.1rem;">
Continue
</button>
Make buttons stack or fill their container
In Bootstrap 5.3, use display and gap utilities for stacked, full-width buttons. This replaces the older Bootstrap 4 .btn-block approach:
<div class="d-grid gap-2">
<button class="btn btn-primary" type="button">Save</button>
<button class="btn btn-secondary" type="button">Cancel</button>
</div>
The grid utility makes the children fill the available width, and .gap-2 provides space between them. Responsive display utilities can be used when the layout should change at different breakpoints.
Create a Bootstrap badge
A badge uses .badge plus a color helper. In Bootstrap 5.2 and later, .text-bg-* combines a background color with a contrasting foreground color:
<span class="badge text-bg-secondary">New</span>
<span class="badge rounded-pill text-bg-success">Active</span>
Add .rounded-pill when you want a pill-shaped badge; omit it for the regular badge shape. A badge scales with the font size of its immediate parent, so placement inside a heading or button affects its size. Older examples may combine .bg-* and .text-* utilities manually. For current examples, see Bootstrap’s Badges documentation.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Add a badge or count to a button
Keep an inline count understandable
For a simple counter, put the badge inside the button and include a visible label that explains what is counted:
<button type="button" class="btn btn-primary">
Notifications <span class="badge text-bg-secondary">4</span>
</button>
The word “Notifications” provides context for the number. Do not rely on badge color or visual placement alone to explain its meaning. If context is not clear to assistive technology from the surrounding text, add explanatory text with .visually-hidden.
Position a counter at the button’s corner
Use .position-relative on the button and positioning utilities on the badge. Include hidden text that describes the count for screen-reader users:
<button type="button" class="btn btn-primary position-relative">
Messages
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill text-bg-danger">
4
<span class="visually-hidden">unread messages</span>
</span>
</button>
The badge is visually attached to the button’s top-right corner, while the hidden text supplies the count’s meaning beyond its color and position.
Represent disabled and toggled button states
Disable an action button
For a native button, use its boolean disabled attribute:
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
<button type="button" class="btn btn-primary" disabled>Saving</button>
Disable a button-styled link carefully
An anchor does not support the native disabled attribute. Bootstrap recommends adding .disabled and aria-disabled="true", and omitting href when possible:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
<a class="btn btn-primary disabled" aria-disabled="true">Unavailable</a>
If the anchor must keep an href, Bootstrap warns that pointer-events: none alone does not stop keyboard activation. Also remove it from the tab order with tabindex="-1" and use custom JavaScript to prevent the action. Test both pointer and keyboard behavior; a visual disabled style is not a complete interaction safeguard.
Mark an initially pressed toggle
For a button that starts in its toggled state, include both .active and aria-pressed="true" in the initial markup:
<button type="button" class="btn btn-primary active" aria-pressed="true">
Follow
</button>
If a script later changes the pressed state, keep the visible state and aria-pressed value in sync.
Check accessibility and contrast
- Use visible action text rather than conveying purpose through color alone.
- For a count whose meaning would otherwise depend on its position or appearance, add clear visible text or
.visually-hiddenexplanatory text. - Check the actual foreground/background pairing in the finished page. Bootstrap notes that some default palette combinations may not meet the cited WCAG 2.1 contrast recommendations, especially on light backgrounds.
- Use the correct interactive element and ensure disabled or toggled states are conveyed and behave as intended.
Bootstrap’s accessibility overview emphasizes that accessible results depend substantially on the author’s markup, styling, and scripting. A framework class does not replace checking the rendered interface with the actual content and colors you use.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Troubleshoot buttons and badges that do not look right
- The button looks like plain text: confirm Bootstrap’s stylesheet is loaded and that the element has both
.btnand a variant class. The base class by itself has no explicit hover and focus treatment. - The styles are inconsistent with the examples: check which Bootstrap version the page loads. Use examples for that version;
.text-bg-*helpers are documented from Bootstrap 5.2 onward. - The button does not fill the container: in Bootstrap 5.3, wrap the buttons in a
.d-gridcontainer; do not rely on the removed-from-this-workflow Bootstrap 4.btn-blockpattern. - The badge count is unclear: add a visible label or suitable
.visually-hiddentext. Color and corner placement alone do not explain a count. - The button is difficult to read: test the specific text and background combination against the page background, particularly with light variants or outlines.
- A disabled link still activates from the keyboard: styling and
pointer-eventsdo not disable keyboard activation. Remove thehrefif possible; otherwise usetabindex="-1"and JavaScript to prevent the action.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server; it does not generate Bootstrap markup or replace the implementation steps above. If your next task is capturing a page after building it, one GET request can return a screenshot or PDF. See the ScreenshotNeo documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
- Cookie banners, popups, and chat widgets are removed before the shot; those cleanup steps can be turned off.
- Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Responses identify the page verdict and billing status in headers.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for AI agents and MCP clients. - The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo free to try 1,000 screenshots a month without a card.
Frequently Asked Questions
Can I use a Bootstrap button class on an anchor?
Yes. Bootstrap styles anchors with button classes. Use an anchor when it navigates; for an anchor that performs an in-page action, add role="button" and implement the action.
Do Bootstrap badges need JavaScript?
A badge is styled with CSS classes. JavaScript is only needed if your application changes the badge content or state dynamically.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

