0

Possible Duplicate:
Complex CSS selector for parent of active child

I have the following html:

<ul>
  <li><href ="#">One</a></li>
  <li><href ="#" class="active">Two</a></li>
  <li><href ="#">Three</a></li>
</ul>

I want to target an li who has a child anchor with a class of active:

I believe something like this would work in css4:

li! > a.active {

I have the following sass which is not working:

ul{
  li{
    a.active &{
      //whatever
    }
  }
} 

What would be the correct way of targeting the parent that has a child with a certain class?

Cœur
  • 32,421
  • 21
  • 173
  • 232
dagda1
  • 21,477
  • 48
  • 188
  • 367

1 Answers1

0

Since there is no way to do it in current CSS, compilers like SASS and LESS can only do so much. Please read Dan's answer on parent selectors in CSS at https://stackoverflow.com/a/1014958/1947535 if you haven't seen it already (although you probably have given the CSS4 spec snippet)

Community
  • 1
  • 1
m.brindley
  • 1,168
  • 8
  • 17