Msg#: 4078579 posted 7:15 pm on Feb 11, 2010 (gmt 0)
How do I style a <p> that's followed by a <ul> using selectors? I know how to style the <ul> that follows a <p> (the '+' selector does that), but how do I go the other way? In other words, how do I indicate "precedes" instead of "follows"?
:n-child won't work for me in this case since I don't want to lock in a specific page order beyond the sibling relationship between <p> and <ul>.
Basically I want my style to affect the E1 instead of the E2 (as W3C refers to them).
Msg#: 4078579 posted 8:59 pm on Feb 11, 2010 (gmt 0)
My goal in this is to remove the whitespace above a <ul>. That requires margin-top:0 for the <ul> and margin-bottom:0 for the <p>. However, I don't want to set margin-bottom:0 on every <p> on the page.
I suppose I could do a class declaration just for those <p>s I want to change, but that seems so......manual.
But, if selectors can't do it -- and I think I agree that it can't be done -- then a new class will have to be the way.