См. Этот пример http://jsfiddle.net/jwmCd/
HTML
<div class="round-buttons">
<a href="#">hello</a>
<a href="#">world</a>
<form method="get" action="/search" id="search">
<input name="q" type="text" size="40" placeholder="Search...">
</form>
</div>
CSS
.round-buttons a:first-child {background:red}
.round-buttons a:last-child {background:green}
.round-buttons a:last-child {background:green}
не применяется в этом состоянии.
Динамически может быть больше ссылок, и я хочу назначить разные стили для Первого и последнего Якоря.