CSS :not (selector) 选择器的作用
cssweb developmentfront end technology更新于 2025/5/15 16:12:17
使用 CSS :not(selector) 选择器可以为所有非指定元素添加样式。您可以尝试运行以下代码来实现 :not 选择器
示例
<!DOCTYPE html>
<html>
<head>
<style>
p {
color: red;
}
:not(p) {
color: blue;
}
</style>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

