【发布时间】:2013-10-03 23:32:30
【问题描述】:
假设我得到了这个页面:
<body>
<h1>Hello!</h1>
<div class="wrapper">
<div class="anotherclass">
<h1>Another heading 1</h1>
</div>
<div class="yetanotherclass">
<h1>Yet another heading 1</h1>
</div>
</div>
<h1>Good bye!</h1>
<div class="class">
<h1>Good bye. And this time I mean it.</h1>
</div>
</body>
我想选择所有不在wrapper 类中的H1 元素。我怎样才能用 CSS 做到这一点?
我不想要这样的“解决方案”
body h1, body .class h1 {style definitions}
我更喜欢这种:
h1:not(.wrapper > h1) {style definitions}
有什么办法吗?
【问题讨论】:
标签: css css-selectors