How to change the css of color of select2 tags?

后端 未结 8 1853
萌比男神i
萌比男神i 2020-12-31 06:47

I just started using project for showing multiple tags from a select box and it works great, thanks for the library.

I just need to modify the color or css of the ta

8条回答
  •  囚心锁ツ
    2020-12-31 07:27

    Adding this CSS worked for me:

    .select2-selection__choice {
      background-color: red !important;
      filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0);
      background-image: -webkit-linear-gradient(top, red 25%, yellow 52%, green 25%, purple 100%) !important;
      background-image: -moz-linear-gradient(top, red 25%, yellow 52%, green 25%, purple 100%) !important;
      background-image: -o-linear-gradient(top, red 25%, yellow 52%, green 25%, purple 100%) !important;
      background-image: -ms-linear-gradient(top, red 25%, yellow 52%, green 25%, purple 100%) !important;
      background-image: linear-gradient(top, red 25%, yellow 52%, green 25%, purple 100%) !important;
      -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0, 0, 0, 0.05) !important;
      -moz-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0, 0, 0, 0.05) !important;
      box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0, 0, 0, 0.05) !important;
      color: white !important;
      border: 1px solid #aaaaaa !important;
    }
    

    Example Fiddle:

    http://jsfiddle.net/sajjansarkar/hvsvcc5r/

    (yes I went crazy with the colors to demonstrate my point ;-) )

提交回复
热议问题