silo
2/28/2017 - 11:34 AM

CSS: get previous sibling

CSS: get previous sibling

<a href="#">test</a>
<a href="#" class="active">test</a>
<a href="#">test</a>

<p>
test
</p>
<img class="image" src="http://placehold.it/350x150">

<style>
  a:not(.active) { background:red }
  a.active + a { background:yellow }

  p:not(.image) { color: red; }
</style>