css :not 选择器

:not 选择器是css3里面的

:not([class]){color:red;}  // 没有class属性的元素都设置为红色

p:not([class]){color:red;} // 没有class属性的p元素都设置为红色

:not(p) {color:red;} // 全都是红色,P也变红,除非另外设置P的颜色

p{color:yellow;}

:not(p){color:red;}  // 所有非P红色, P黄色

原文地址:https://www.cnblogs.com/bushe/p/4552615.html