Re: [css-d] 'Reverse' adjacent sibling selector?
+1 Tim: Have a look here: http://archivist.incutio.com/viewlist/css-discuss/112698 Regards, Márcio __ 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/
Re: [css-d] 'Reverse' adjacent sibling selector?
why not add a class to the p tag? and style with css? On Fri, Oct 1, 2010 at 1:08 PM, Ryan wrote: > CSS does not navigate in reverse. You would need xpath, JavaScript, or > modified HTML structure for what you have described. > > On Oct 1, 2010, at 5:29 AM, Daniel Baars wrote: > > > Hello, > > > > Is there a way in CSS to match a first element which is the PREVIOUS > > sibling to the second element? > > > > Example: I want to target the paragraph before every header. > > > > Header > > First paragraph > > Last paragraph > > Another header > > > > After quite a bit of Google-ing it doesn't seem possible but I don't > > understand why. Is this a scenario that I should solve in a more > > intelligent way than I have been able to think of so far? > > > > Cheers, > > > > > > Daniel > > __ > > 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/ > > __ > 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/ > __ 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/
Re: [css-d] 'Reverse' adjacent sibling selector?
CSS does not navigate in reverse. You would need xpath, JavaScript, or modified HTML structure for what you have described. On Oct 1, 2010, at 5:29 AM, Daniel Baars wrote: > Hello, > > Is there a way in CSS to match a first element which is the PREVIOUS > sibling to the second element? > > Example: I want to target the paragraph before every header. > > Header > First paragraph > Last paragraph > Another header > > After quite a bit of Google-ing it doesn't seem possible but I don't > understand why. Is this a scenario that I should solve in a more > intelligent way than I have been able to think of so far? > > Cheers, > > > Daniel > __ > 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/ __ 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/
Re: [css-d] 'Reverse' adjacent sibling selector?
Hi, Daniel, the best I can come up with is to target the last child in the following markup. div.section p:last-child {} Header First paragraph Last paragraph Another header I suggest you to have a look on browser compatibility tables: http://www.quirksmode.org/css/contents.html#t35 The last-child selector is not supported until IE 9. Therefore I would simply use the following: p.last-child {} Header First paragraph Last paragraph -- >{U}(")> Čimo Michal Čizmazia On Fri, Oct 1, 2010 at 11:29, Daniel Baars wrote: > > Hello, > > Is there a way in CSS to match a first element which is the PREVIOUS > sibling to the second element? > > Example: I want to target the paragraph before every header. > > Header > First paragraph > Last paragraph > Another header > > After quite a bit of Google-ing it doesn't seem possible but I don't > understand why. Is this a scenario that I should solve in a more > intelligent way than I have been able to think of so far? > > Cheers, > > > Daniel > __ 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/
[css-d] 'Reverse' adjacent sibling selector?
Hello, Is there a way in CSS to match a first element which is the PREVIOUS sibling to the second element? Example: I want to target the paragraph before every header. Header First paragraph Last paragraph Another header After quite a bit of Google-ing it doesn't seem possible but I don't understand why. Is this a scenario that I should solve in a more intelligent way than I have been able to think of so far? Cheers, Daniel __ 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/