tests - selector support

If a line of text is red, the UA failed — CSS 2.1 CSS3 selectors. Opera 8.5 (no support for CSS3 selectors) and Safari (partial support). Gecko, iCab 3.0 and Opera 9 are correct.

More on CSS selectors.

this should not be red

this should not be red, attribute [class="t1"]

this should not be red, attribute [class~="t2"]

this should not be red, attribute [lang|="en"]

Ceçi n'est pas en rouge, :lang pseudo-class :lang(fr)

this should not be red, attribute [class^="t3"]

this should not be red, attribute [class$="t4"]

this should not be red, attribute [class*="t5"]

this should not be red #test2>p

this should not be red, but blue #test2 p+p

this should not be red, nor blue, but cyan #test2 p+p.t4.tz

this should not be red, but blue #test2 p+p

this should not be red #test3 p[class].

this should not be red, but blue #test3 p~p.

this should not be red, nor blue, but green, empty class attribute.

Styles in use

.testgrid p {color:red}
#test1 p:first-child {color:green}
#test1 p[class="t1"] {color:green}
#test1 p[class~="t2"] {color:green}
#test1 p[lang|="en"] {color:green}
#test1 p:lang(fr) {color:green}
#test1 p[class^="t3"] {color:green}
#test1 p[class$="t4"] {color:green}
#test1 p[class*="t5"] {color:green}

#test2>p {color:green}
#test2 p+p {color:blue}
#test2 p+p.t4.tz {color:#0cc}

#test3 p[class] {color:green}
#test3 p~p {color:blue}

code {color:#000;}

Last modified: February 23 2006 02:24:41 GMT.