Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #34016
Closed
Open
Issue created May 18, 2021 by Administrator@rootContributor

Apply .text-dark for .badge with some .bg-* classes

Created by: theonlypwner

In Bootstrap 4, class="badge badge-light" was enough, but in Bootstrap 5, it's class="badge bg-light text-dark". This is less convenient when switching between badge bg-dark and badge bg-light, since text-dark also has to be added or removed.

Bootstrap 5 should apply the styles for text-dark to .badge.bg-light and .badge.bg-warning. The Bootstrap 5 docs also recommend text-dark for bg-info, but I find that one is not necessary.

One workaround is to add this to our SCSS files, which is what Bootswatch does:

@import "~bootstrap/scss/bootstrap";

.badge {
  &.bg-warning,
  &.bg-info, /* optional */
  &.bg-light {
    @extend .text-dark;
  }
}
Assignee
Assign to
Time tracking