【发布时间】:2021-07-31 00:28:03
【问题描述】:
首先对不起我的英语不好。 我想从 CSS 中的所有选择器中排除一个类。
我需要使用类似的东西
(h1, h2, h3, h4, ..., p, span, a, ...):not(.exclude){
font-family: arial;
}
代替:
h1:not(.exclude), h2:not(.exclude), ..., a:not(.exclude){
font-family: arial;
}
【问题讨论】:
-
只需为
.exclude元素设置一个特定规则,该规则将覆盖应用于所有元素的默认规则 -
你不能单独使用 :not(.exclude) 有什么原因吗?您是否有任何特定的 .exclude 元素要从该规则中排除?
标签: html css css-selectors