How to change the css of color of select2 tags?

后端 未结 8 1906
萌比男神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:33

    For those that only want to change the color of some of the select2 boxes:

    Instead of directly modifying the Select2 CSS properties of select2-choice directly, use the ID generated by select2 for the select2 div (this will be #s2id_yourelementid) to select its children carrying the select2-choice class.

    For example, if I want to modify an element, #myelement, that I apply Select2 to, then to change the color, I would add the following to my css:

    #s2id_myelement > .select2-choice{
         background-color:blue;
    } 
    

提交回复
热议问题