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.
我在body标签的每一页都有不同的类,我在body标签中使用css作为#top div
<body class="one"> <div id="top"></div> </body> #top{ /*css code here*/ }
我想使用相同的 css 而不是.one这样的类:
.one
#top:not(.one){ /*css code here*/ }
更清楚地,我想为#top 的所有页面应用相同的 css,但不应用于 body 类所在的页面.one
在父级上使用:not选择器,而不是在子级上。
:not
body:not(.one) #top { /*css code here*/ }