My question is similar to this one, except the structure of my file is:
<div>
<p><span class="ignore">blah</span></p>
<p>blih</p>
<p>blouh</p>
</div>
I want to have a CSS selector on blih
. If the span
tag is absent, the selector should apply to blah
instead.
I can't use div > p:not(.ignore):first-child
since the ignore
class applies to the span
tag, not the p
tag. I can't apply the ignore
class to the p
tag, since this is generated from Markdown.
Is there a CSS selector that does the job, and avoids having to add a span
tag to blih
?