How to change font color of select2 control using css

旧巷老猫 提交于 2019-12-04 14:36:31

Here's a list of classes you need to use for styling select2 input:

/* Input field */
.select2-selection__rendered {  }

/* Around the search field */
.select2-search {  }

/* Search field */
.select2-search input {  }

/* Each result */
.select2-results {  }

/* Higlighted (hover) result */
.select2-results__option--highlighted {  }

/* Selected option */
.select2-results__option[aria-selected=true] {  }

If you want you can play around in this JSBin I've created, so you can test things out.

I've updated my JSBin, in it you can see how you can style a specific select2 list (instead of globally adding styles)

.select2-results .select2-highlighted {
    background: #3ea211;
}

try this css its will work fine

.select2-container--default .select2-results__option--highlighted[aria-selected] {
   background-color: #5897fb !important;
   color: white;
}

try this

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!