Twitter Bootstrap 3.0 how do I “badge badge-important” now

后端 未结 9 1757
执念已碎
执念已碎 2021-01-29 19:01

In version two I could use

badge badge-important

I see that the .badge element no longer has contextual (-success,-primary,etc..) c

9条回答
  •  不思量自难忘°
    2021-01-29 19:48

    If using a SASS version (eg: thomas-mcdonald's one), then you may want to be slightly more dynamic (honor existing variables) and create all badge contexts using the same technique as used for labels:

    // Colors
    // Contextual variations of badges
    // Bootstrap 3.0 removed contexts for badges, we re-introduce them, based on what is done for labels
    .badge-default {
      @include label-variant($label-default-bg);
    }
    
    .badge-primary {
      @include label-variant($label-primary-bg);
    }
    
    .badge-success {
      @include label-variant($label-success-bg);
    }
    
    .badge-info {
      @include label-variant($label-info-bg);
    }
    
    .badge-warning {
      @include label-variant($label-warning-bg);
    }
    
    .badge-danger {
      @include label-variant($label-danger-bg);
    }
    

    The LESS equivalent should be straightforward.

提交回复
热议问题