webkit - CSS selector to apply rules to an element if before another element -


I am looking for a way to implement elements in a different way, depending on the That's what happens next. For example, with this HTML:

  & lt; Ul & gt; & Lt; Li & gt; & Lt; Span class = "title" & gt; Some title & lt; / Span & gt; & Lt; Span class = "subtitle" & gt; With some subtitles & lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Span class = "title" & gt; Only one title & lt; / Span & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

I want to apply different rules for .title , whether it depends on weather or not .subtitle

The closest I can understand is that the adjacent brother selector

  .title + .subtitle {/ * rule * /}  

But this applies to .subtitle rules for elements that are before .title . Instead, I want to apply the rule with .title elements with the .subtitle element.

Note: This is not important, it is widely supported browsers for my current use is my only goal that is webkit based on this time.

There is no brother-cum-organizer for "old" in siblings

< P> In this case, you can be away from : child-only .

  li> Span.title: only-child {/ * rules * /}  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -