简体   繁体   English

更改角度材料设计中 md-focused 复选框的颜色

[英]Change the colour of the md-focused checkbox in angular material design

I am using Angular Material and I have used md-checkboxes throughout however when I have a checkbox checked and focused it gives me a strange pink circular shadow around the checkbox (I just want to be able to change the colour)我正在使用 Angular Material 并且我一直使用 md-checkboxes 但是当我选中一个复选框并聚焦时,它会在复选框周围产生一个奇怪的粉红色圆形阴影(我只想能够改变颜色)

<md-checkbox class="gray md-default-theme md-checked" checked="checked">

// When this is checked and in focus it adds the class 'md-focused' & gives this a faint pink circle around the checkbox // 当它被选中并处于焦点时,它会添加类“md-focused”并在复选框周围给出一个淡粉色圆圈

<md-checkbox class="gray md-default-theme md-checked md-focused" checked="checked">

Can anyone explain how I alter this to change the colour via css?谁能解释我如何改变它以通过 css 改变颜色?

You have to override .md-focused .md-container:before because the style is added to a pseudo-element... ( PLUNKER DEMO )您必须覆盖.md-focused .md-container:before因为样式已添加到伪元素...( PLUNKER DEMO

  • To override all checkboxes focus:要覆盖所有复选框焦点:

     md-checkbox.md-focused .md-container:before { background-color: transparent !important; }
  • To override just certain checkboxes:仅覆盖某些复选框:

    HTML HTML

     <md-checkbox class="md-checkbox-no-focused"> Checkbox without focus </md-checkbox>

    CSS CSS

     .md-checkbox-no-focused .md-container:before { background-color: transparent !important; }

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

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