Is there some way to address the first member of an adjacent sibling selector,
as opposed to the last member?
For example, if I wanted to address p tags immediately preceding an h2, how
might I go about it? Thanks.
--
___
RICK GORDON
EMERALD
But that affects p tags that fall AFTER h2's, not before, no?
--
On 8/30/10 at 12:37 PM +0100, MEM wrote in a message entitled
Re: [css-d] Adjacent Sibling Selectors in Reverse?:
2010/8/30 Rick Gordon li...@rickgordon.com
Is there some way to address the first member
Something like this perhaps?
h2+p {
}
But that affects p tags that fall AFTER h2's, not before, no?
Yes, that's correct. I don't think there's a way to do this without Javascript.
What about styling the h2 instead of the p? I don't know what your use case
is, but if, for example, you
to the h2, I could
adjust the margin-bottom of that, rather than the margin-top of the h2.
Rick Gordon
--
On 8/30/10 at 7:03 PM +, Climis, Tim wrote in a message entitled
Re: [css-d] Adjacent Sibling Selectors in Reverse?:
Something like this perhaps?
h2+p
Adjacent sibling in reverse is not possible but you could adapt direct siblings
using something like this:
h2 p {
color: yellow;
}
hth
--- On Mon, 30/8/10, Rick Gordon li...@rickgordon.com wrote:
Is there some way to address the
first member of an adjacent sibling selector, as opposed
On Mon, Aug 30, 2010 at 1:16 PM, Rick Gordon li...@rickgordon.com wrote:
Yes, Tim, I understand that, and in fact, I am currently addressing the h2.
The reason why I was trying to do it the other way is because the context is
for EPUB formatting, and space above the h2 causes it to fall lower
If I understand your question correctly, something like the stuff below
might work for you. I used the following HTML, based on your example:
p1st paragraph/p
p2nd paragraph/p
h2Some heading/h2
p3rd paragraph/p
p4th paragraph/p
p5th paragraph/p
and this CSS:
p { color: green; }
Thanks all.
I finally decided to wrap the major groupings in a div class=by-country
wrapper, and set margin-bottom for the .by-country class.
Rick Gordon
--
On 8/30/10 at 10:25 PM +0200, Joergen W. Lang wrote in a message entitled
Re: [css-d] Adjacent Sibling Selectors