是否可以将伪元素与 :is() pseudo-class 一起使用?
Is it possible to use pseudo-elements with the :is() pseudo-class?
这样的东西可以用:is()
伪class来写吗?
div p,
div p::before,
div p::after {
/* selectors */
}
我试过了,但没用:
div :is(p, p::before, p::after) {
/* selectors */
}
不,你不能。
Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()
. ref
这样的东西可以用:is()
伪class来写吗?
div p,
div p::before,
div p::after {
/* selectors */
}
我试过了,但没用:
div :is(p, p::before, p::after) {
/* selectors */
}
不,你不能。
Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within
:is()
. ref