Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 选择2多选更改所选值的样式_Jquery_Jquery Select2 - Fatal编程技术网

Jquery 选择2多选更改所选值的样式

Jquery 选择2多选更改所选值的样式,jquery,jquery-select2,Jquery,Jquery Select2,我希望尝试从select2选择中格式化或更改所选项目的样式。也就是说,当您在多选项上使用select2(下拉选择选项字段)时,您选择的选项会跳入多选框,并在其上加上一个小x,以便在您选择时删除 我正在尝试格式化这些选择的内容(见图),以便页面看起来更整洁。试图使字体变小,背景颜色变为不同的颜色,努力。。。 有人可以在这方面提供帮助吗?您可以针对给定文件覆盖给定文件css文件您可以针对给定文件覆盖给定文件css文件以下是一些有用的css选择器,其样式如下: .select2-selection_

我希望尝试从select2选择中格式化或更改所选项目的样式。也就是说,当您在多选项上使用select2(下拉选择选项字段)时,您选择的选项会跳入多选框,并在其上加上一个小x,以便在您选择时删除

我正在尝试格式化这些选择的内容(见图),以便页面看起来更整洁。试图使字体变小,背景颜色变为不同的颜色,努力。。。


有人可以在这方面提供帮助吗?

您可以针对给定文件覆盖给定文件css文件

您可以针对给定文件覆盖给定文件css文件

以下是一些有用的css选择器,其样式如下:

.select2-selection__choice{
    margin-top: 0px!important;
    padding-right: 5px!important;
    padding-left: 5px!important;
    background-color: transparent!important;
    border:none!important;
    border-radius: 4px!important;
    background-color: rgba(0, 139, 139, 0.09) !important;
}

.select2-selection__choice__remove{
    border: none!important;
    border-radius: 0!important;
    padding: 0 2px!important;
}

.select2-selection__choice__remove:hover{
    background-color: transparent!important;
    color: #ef5454 !important;
}

以下是一些有用的css选择器,其样式如下:

.select2-selection__choice{
    margin-top: 0px!important;
    padding-right: 5px!important;
    padding-left: 5px!important;
    background-color: transparent!important;
    border:none!important;
    border-radius: 4px!important;
    background-color: rgba(0, 139, 139, 0.09) !important;
}

.select2-selection__choice__remove{
    border: none!important;
    border-radius: 0!important;
    padding: 0 2px!important;
}

.select2-selection__choice__remove:hover{
    background-color: transparent!important;
    color: #ef5454 !important;
}

您是对的,这需要通过重写css来完成,例如使用以下命令:
.select2 container--default.select2 selection--multiple.select2-selection_uuuchoice{color:red;}
谢谢,整理我:)您是对的,这需要通过重写css来完成,例如,使用以下内容:
.select2 container--default.select2 selection--multiple.select2-selection\uuuuuu choice{color:red;}
谢谢,我已经整理好了:)