0

Possible Duplicate:
Is there a CSS parent selector?

<ul class="page-numbers">
    <li><a href="/blog/page/1/" class="prev page-numbers">«</a></li>
    <li><a href="/blog/page/1/" class="page-numbers">1</a></li>
    <li><span class="page-numbers current">2</span></li>
    <li><a href="/blog/page/3/" class="page-numbers">3</a></li>
    <li><a href="/blog/page/4/" class="page-numbers">4</a></li>
</ul>

Is there a way to target only the li that is the parent of a.prev? I can't use first-child because when I'm on the first page, a.prev doesn't show. Would appreciate any help on this. Thank you.

Community
  • 1
  • 1
John
  • 627
  • 9
  • 19

1 Answers1

0

Not with CSS only. There are no parent selectors in CSS. However if you can/want to dive in to javascript/jQuery, you could do something like this:

$('.page-numbers a').closest('li').css({
    'height': '18px',
    'background': '#ccc'
});
Faust
  • 13,751
  • 9
  • 48
  • 107