<div class="outer">
<a href="#">First</a>
<a href="#">Second</a>
<div>
<a href="#">Third</a>
</div>
<a href="#">Fourth</a>
<a href="#">Fifth</a>
</div>
.outer a:not(:last-of-type) {
color: red;
}