Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当 ID 为“main”的块出现异常时,为什么所有三个元素都突出显示?
body * :not(#main) { border: 1px solid black; }
<nav><a href="link">link</a></nav> <div> <a href="link">link</a> </div> <div id="main"> <a href="link">link</a> </div>
不知道你为什么要这样做,但这就是你想要的。
代码笔
它是 * 和 :not(main) 之间的额外空格。
body *:not(#main)