gpt4 book ai didi

css - 如何在 css not() 选择器中放置多个类?

转载 作者:行者123 更新时间:2023-11-28 09:25:09 24 4
gpt4 key购买 nike

我想在 not() 选择器中堆叠多个类,但 ,;: 不起作用。

input[type=text]:hover:not(.ui-pg-input .mandatory){ background-color: #D9EDF7;}

那么,在 css not() 选择器中堆叠类的正确方法是什么?

最佳答案

两种语法选择:

  1. 在一个 :not 运算符中使用两个类:

input[type=text]:hover:not(.ui-pg-input.mandatory){background-color: #D9EDF7;}

(注意类之间删除的空白)

  1. 使用 :not 运算符两次:

input[type=text]:hover:not(.ui-pg-input):not(.mandatory){background-color: #D9EDF7;}

但是请注意,两者具有不同的含义:第一个使用 运算符,因此它匹配所有不具有两个类(因此没有或一个)的元素,而第二个使用 运算符,从而匹配所有没有一个或另一个类的元素(因此没有)。所以这取决于你想做什么......

关于css - 如何在 css not() 选择器中放置多个类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32796523/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com