html:
<div class="wraper">
<div class="box">
<span class="text">Test2</span>
<span class="loser text">Test1</span>
</div>
<div class="box">
<span class="text">Test1</span>
<span class="text">Test2</span>
</div>
<div class="box">
<span class="loser">Test1</span>
<span class="text">Test2</span>
</div>
</div>
css:
.wraper .loser ~ .text {
color: pink;
}
The sibling selector only gets applied when the class targeted is in front of the div. Shouldn't it be applied regardless of the span ordering?
What I am trying to achieve is to always color the spans in the box that contains a loser class.
Codepen if you want to play around: http://codepen.io/shooshte/pen/grxJpZ