3

Is the following CSS syntax valid?

a:first-child:hover { background-color: transparent; }

If so, what is the compatibility as far as browsers? For example, is it compatible in IE8, IE6+, Firefox 4, Chrome, etc.

1 Answer 1

5

Combo first-child and :hover is correct(IE6 recognize only last pseudo-class in the chain):

div span:first-child:hover {
  color: red;
}
<div>
  <span>asdasd</span>
  <span>asdasd</span>
  <span>asdasd</span>
</div>

Sign up to request clarification or add additional context in comments.

2 Comments

Yes it works but also take a look here
This isn't so much an issue of IE6 not recognizing multiple pseudo-classes in a chain as that it doesn't recognize :first-child. It does sound like a reasonable claim, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.