【发布时间】:2021-07-31 10:22:02
【问题描述】:
下面的:is() 用法不适用于伪元素,有人可以解释一下吗?
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Test</title>
<link rel="stylesheet" href="https://unpkg.com/normalize.css" />
<style>
body {
background: #000;
color: #eee;
}
button::before {
content: 'foo';
}
/* ???? not working */
:is(button::before) {
content: none;
}
/* ???? not working either */
button:is(::before) {
content: none;
}
</style>
</head>
<body>
<button>Test</button>
</body>
</html>
【问题讨论】:
标签: html css css-selectors