Odd/Even with a hidden class

If all you have is just one hidden class, then this would be trivial. But I suspect, there is no easy way out for more than 1 :/

by Jens Grochtdreis

HTML

<p></p>
<p></p>
<p></p>
<p class="hidden"></p>
<p></p>
<p></p>
<p></p>

CSS

p
{ 
    height: 2em; border: 1px solid black; 
}

p, 
p.hidden:nth-child(even) + p:nth-of-type(odd) + p:nth-of-type(even) {
    background: khaki;     
}

p:nth-child(even),
p.hidden:nth-child(even) ~ p:nth-of-type(odd) { 
    background: indianred; 
}

.hidden { display: none; }

JavaScript

// Original: http://jsfiddle.net/nimbu/EK9yG/