In CSS is it possible to select all elements before an element with a given class?
Example HTML:
<div>
<a href>One</a>
<a href>Two</a>
<a href>Three</a>
<a href class="active">Four</a>
<a href>Five</a>
</div>
And CSS:
.active:(all-before) {
border-left: solid 1px #C0FFEE;
}
So links 'One', 'Two', and 'Three' would would have a left border but 'Four' and 'Five' would not.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…