Specificity of Pseudo-classes

Yes, pseudo-classes also have specificity, and this should affect the cascade. See CSS2 section 6.4.3.

Prerequisites
Browsers that are subjected to this test should support the first-child pseudo-class.

This browser does not support first-child.

1. Specificity

    DIV.a DIV :first-child { color: green }
    DIV.a     .first-child { color: red }
I should be GREEN!

2. Declaration Order

    DIV.b :first-child { color: red }
    DIV.b .first-child { color: green }
I should be GREEN!
    DIV.c .first-child { color: red }
    DIV.c :first-child { color: green }
I should be GREEN!

Submit Results

This browser does not support first-child.

How does your browser fare on this test?


Up to the Evil Tests Page.

Last updated in January 1999.