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 on the page 
if the h2 is at the top of a page. By addressing the p prior 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 +0000, Climis, Tim wrote in a message entitled
"Re: [css-d] Adjacent Sibling Selectors in Reverse?":

> > >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 wanted extra bottom margin on the last paragraph 
>in the section, you could put extra top-margin on the h2 instead. 
>
>Perhaps something like:
>h2 {margin-top: 2em}
>h2:first-of-type {margin-top: 1em} /* makes the margin smaller for the first 
>h2 on the page */
>
>---Tim


-- 
___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________

WWW:   http://www.shelterpub.com
______________________________________________________________________
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to