[英]Change md-checkbox color
So it looks I can change the background-color of an empty md-checkbox
by doing : 所以看起来我可以通过执行以下操作来更改空md-checkbox
的背景颜色:
md-checkbox .md-icon {
background: red;
}
But I can't manage to change the background of a checked md-checkbox
. 但我无法设法更改已检查的md-checkbox
的背景。 I tried to play with :checked
, ::before
, ::after
... But didn't succeed. 我试着玩:checked
, ::before
, ::after
...但没有成功。
How should I proceed ? 我该怎么办?
You need to use theme class as well as md-checked
class combination in order to define selector with higher specificity. 您需要使用主题类以及md-checked
类组合,以便定义具有更高特异性的选择器。 For example: 例如:
md-checkbox .md-icon {
background: red;
}
md-checkbox.md-default-theme.md-checked .md-icon {
background: orange;
}
And of course, avoid using !important
, this is a sign that something is wrong with your styles. 当然,避免使用!important
,这表明你的风格出了问题。
in new version added underscore ._md-icon: 在新版本中添加了下划线._md-icon:
md-checkbox.md-checked ._md-icon {
background-color: white;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.