Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This topic summarizes the ID Selectors that can be used in Cascading Style Sheets. These are made up from Pseudo Elements and Pseudo Classes.

Description

Structure Windows Mobile CSS Mobile WAP CSS CSS1 CSS2 CSS3 Comments

*

Yes

Yes

Yes

No

Yes

No

Match any element.

E

Yes

Yes

Yes

No

Yes

No

Match any E element.

E F

Yes

Yes

Yes

No

Yes

No

Match any F element that is a descendant of an E element.

E > F

Yes

No

No

No

Yes

No

Match any F element that is a child of an E element.

E:active

Yes

Yes

 

No

Yes

No

Match any E element when the user has that element active.

E:first-child

No

No

No

No

Yes

No

Match an E element when it is the first child of its parent.

E:first-line

No

No

No

No

 

No

 

E:first-letter

No

No

No

No

 

No

 

E:before

No

No

No

No

?

No

 

E:after

No

No

No

No

?

No

 

E:focus

Yes

Yes

No

No

Yes

No

Match any E element when the user has that element in focus.

E:hover

No

No

No

No

Yes

No

Match any E element when the user is hovering on that element.

E:lang(c)

No

No

No

No

Yes

No

Matches an E element if it is in the language c.

E:link

Yes

Yes

Yes

No

Yes

No

Matches an E element that is a unvisited hyperlink.

E:not(c)

Yes

No

No

No

No

No

 

E:visited

Yes

Yes

No

No

Yes

No

Matches an E element that is a visited hyperlink.

E + F

Yes

No

No

No

Yes

No

Matches an element F that is immediately preceded by an E element at the same level.

E[X]

Yes

No

No

No

Yes

No

Matches any E element with the X attribute set.

E[X="warning"]

Yes

No

No

No

Yes

No

Matches any E element with the X attribute is set exactly to the value "warning".

E[X~="warning"]

Yes

No

No

No

Yes

No

Matches any E element with the X attribute is a space separated list and one of the elements set exactly to the value "warning".

E[lang|="en"]

Yes

No

No

No

Yes

No

Matches any E element with the "lang" attribute has a hyphen-separated list of values beginning with "en".

div.warning

Yes

Yes

Yes

No

Yes

No

Language specific, but should be the same as DIV[class="warning"].

E#X

Yes

Yes

Yes

No

Yes

No

Matches any E element that has an ID which is "X"

See Also