我想在 not()
选择器中堆叠多个类,但 ,;:
不起作用。
input[type=text]:hover:not(.ui-pg-input .mandatory){ background-color: #D9EDF7;}
那么,在 css not()
选择器中堆叠类的正确方法是什么?
最佳答案
两种语法选择:
- 在一个
:not
运算符中使用两个类:
input[type=text]:hover:not(.ui-pg-input.mandatory){background-color: #D9EDF7;}
(注意类之间删除的空白)
- 使用
:not
运算符两次:
input[type=text]:hover:not(.ui-pg-input):not(.mandatory){background-color: #D9EDF7;}
但是请注意,两者具有不同的含义:第一个使用 或 运算符,因此它匹配所有不具有两个类(因此没有或一个)的元素,而第二个使用 和 运算符,从而匹配所有没有一个或另一个类的元素(因此没有)。所以这取决于你想做什么......
关于css - 如何在 css not() 选择器中放置多个类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32796523/