So close to a larger solution, but stuck on this little issue… :headbang:
I have this HTML…
<p><span class="byline"><b>2 days ago - by Kate Shaw</b> | Posted in: Nobel Intent</span></p>
<p>
Individuality increases with group size in rodents, making it
easier to recognize group members among lots of potential targets.
</p>
I want to apply a Bottom Margin only when there is a <P> by itself.
If there is a <P> tag and something else (e.g. “<p><span class=“byline”>”) then the Bottom Margin I define here…
If there is a <P> tag and something else (e.g. “<p><span class=“byline”>”) then the Bottom Margin I define here… should be ignored!!!
No it shouldn’t, the <p> tag is not capable of checking to see if there is a span in it and then changing it’s margins if a span present.
What your asking for there is what would be called a Parent Selector and it’s not available with CSS.
How do I do that??
Put the class back on the <p> like I had already done in my last example from your related thread.
The reasons I did that were twofold :
for margin differences
and text styling
Nesting every bit of text in the span from the opening to the closing of the <p> makes that a useless span.
It’s not adding anymore styling ability than the p-class could not have handled on it’s own.
If the <span> spans the whole of the <p>, why not save yourself a tag and put a class on the <p> instead? Then you can simply override any general paragraph styling with p.byline {…}