Skip to main content

:not 伪类选择器

 :not伪类选择器选出与条件不同的元素。

span:not(.sr-only) {

  font-weight: normal;
}
将会选出所有不是sr-only类的span元素。


The :not() pseudo-selector is used to target all elements that do not match the selector - in this case, any of your span elements that do not have the span[class~="sr-only"] class. This ensures that your earlier rules for the sr-only class are not overwritten.

Comments