简体   繁体   English

如何在angularjs的ui-select模块中更改十字按钮的颜色

[英]how to change the color of cross button in ui-select module of angularjs

I am using ui-select for multiple selection in drop down.When an item is selected it shows the cross button on the right upar of selected item. 我正在使用ui-select进行下拉选择。选择一个项目时,它在所选项目的右上方显示十字按钮。 Can I change the color of cross button to red ? 我可以将十字按钮的颜色更改为红色吗?

<ui-select multiple ng-model="multipleUserDemo.selectedUserWithGroupBy" theme="bootstrap" ng-change="refreshUsers($select.search) : '')" style="width:100%;">
  <ui-select-match placeholder="--Select--">
       <span ng-bind = "$item.userName"></span>
  </ui-select-match>
  <ui-select-choices repeat="user in Users track by $index" refresh="refreshUsers($select.search)" refresh-delay="0">
       <div ng-bind-html="user.userName | highlight: $select.search"></div>
           <small>
             Email Id: <span ng-bind-html="user.email | highlight: $select.search"></span>
           </small>
  </ui-select-choices>
</ui-select>

By using Chrome's Developer Tools (F12) you can inspect single elements by pressing Ctrl+Shift+C and clicking the element afterwards. 通过使用Chrome的开发人员工具(F12),您可以通过按Ctrl + Shift + C并随后单击该元素来检查单个元素。 This way I found out that the class of the "cross buttons" is close ui-select-match-close . 这样,我发现“十字按钮”的类是close ui-select-match-close

Chrome outputs the computed styles: Chrome输出计算出的样式:

交叉计算样式

There you can see, that the span has its color -attribute set to #000000 and its opacity -attribute set to 0.2 .With this information you're able to style the buttons with the following CSS: 您可以在其中看到span的color- attribute设置为#000000 ,其opacity -attribute设置为0.2。使用此信息,您可以使用以下CSS设置按钮的样式:

.close.ui-select-match-close {
    color:#f00;
    opacity: 1;
}

Other browsers do have great Developer Tools, too. 其他浏览器也确实具有出色的开发人员工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM