更改md-checkbox颜色

时间:2015-09-03 13:39:17

标签: javascript css angularjs checkbox angularjs-material

所以看起来我可以通过执行以下操作来更改空md-checkbox的背景颜色:

md-checkbox .md-icon {
background: red;
}

但我无法改变已选中md-checkbox的背景。 我尝试使用:checked::before::after ...但没有成功。

我该怎么办?

2 个答案:

答案 0 :(得分:9)

您需要使用主题类以及MyObject object1 = new MyObject(30); MyObject object2 = object1; //this will make them have the same reference // This prints true, as they have the same content. System.out.println(object1.equals(object2)); // This will print true, as they point the same thing, because they have the same reference System.out.println(object1 == object2); // We can see they have the same reference because if we edit one's field, // the other's one will change too. object1.number = 10; System.out.println(object1.number); // prints 10 System.out.println(object2.number); // prints 10 too 类组合,以便定义具有更高特异性的选择器。例如:

md-checked

当然,避免使用md-checkbox .md-icon { background: red; } md-checkbox.md-default-theme.md-checked .md-icon { background: orange; } ,这表明你的风格出了问题。

答案 1 :(得分:6)

在新版本中添加了下划线._md-icon:

md-checkbox.md-checked ._md-icon {
         background-color: white;
}