Can the :not() pseudo-class have multiple arguments?

后端 未结 5 994
旧时难觅i
旧时难觅i 2020-11-22 15:39

I\'m trying to select input elements of all types except radio and checkbox.

Many people have shown that you can

5条回答
  •  猫巷女王i
    2020-11-22 16:31

    Starting from CSS Selectors 4 using multiple arguments in the :not selector becomes possible (see here).

    In CSS3, the :not selector only allows 1 selector as an argument. In level 4 selectors, it can take a selector list as an argument.

    Example:

    /* In this example, all p elements will be red, except for 
       the first child and the ones with the class special. */
    
    p:not(:first-child, .special) {
      color: red;
    }
    

    Unfortunately, browser support is limited. For now, it only works in Safari.

提交回复
热议问题