【发布时间】:2021-08-06 11:08:00
【问题描述】:
当<p> 上方的标签不属于某个类时,我有一个样式可以应用,例如:
:not(.someclass) + p {
color: yellow
}
这适用于以下情况:
<h3 class="someclass">title</h3>
<p>This does not have the style applied</p>
<p>This has the style applied</p>
困扰我的是当<p>上方没有标签时,我希望应用该样式但它没有,例如:
<p>This should have the style applied but it doesn't</p>
您将如何修复 CSS 以涵盖这两种情况?
【问题讨论】:
标签: html css css-selectors