Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 4 badge not working - just not showing up

I'm trying to use bootstrap 4 badge in this way:

<td><span class="badge badge-warning">{{ object.get_type_display }}</span></td>

I'm using:

https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css

What can be a reason?

like image 838
paolo Avatar asked Nov 23 '25 19:11

paolo


2 Answers

At least in Bootstrap version 5.1.x the badges work again after they were dropped in v4.

You can use the following code to display a badge next to a heading:

<h1>Example heading <span class="badge bg-secondary">New</span></h1>

Buttons, background colors and pill badges are now supported as well. You can find the documentation here: https://getbootstrap.com/docs/5.1/components/badge/

like image 111
aleksejjj Avatar answered Nov 26 '25 17:11

aleksejjj


.badge was dropped in the v4:

Dropped the .badge component as it was nearly identical to labels/tags. Use the .tag-pill modifier together with the label component instead for that rounded look.

But they returned it (git issue) so use the latest version - v4.0.0-alpha.6

like image 41
Vucko Avatar answered Nov 26 '25 17:11

Vucko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!