CSS 2.1 Selectors

*

Matches any element.

E

Matches any E element (i.e., an element of type E).

E F

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

E > F

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

E:first-child

Matches element E when E is the first child of its parent.

E:last-child

Matches element E when E is the last child of its parent.

E:link, E:visited

Matches element E if E is the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited).

E:active, E:hover, E:focus

Matches E during certain user actions.

E + F

Matches any F element immediately preceded by a sibling element E.

E[foo]

Matches any E element with the “foo” attribute set (whatever the value).

E[foo="warning"]

Matches any E element whose “foo” attribute value is exactly equal to “warning”.

E[foo~="warning"]

Matches any E element whose “foo” attribute value is a list of space-separated values, one of which is exactly equal to “warning”.

E[foo~="warning"]

Matches any E element whose “foo” attribute value is a list of space-separated values, one of which is exactly equal to “warning”.

E[lang|="en"]

Matches any E element whose “lang” attribute has a hyphen-separated list of values beginning (from the left) with “en”.

DIV.warning

The same as DIV[class~=“warning”]

E#myid

Matches any E element with ID equal to “myid”.

CSS 3.0 Selectors

E[foo^="val"]

Matches any E element having “foo” attribute whose value begins with the prefix “val”.

E[foo$="val"]

Matches any E element having “foo” attribute whose value ends with the suffix “val”.

E[foo*="val"]

Matches any E element having “foo” attribute whose value contains at least one instance of the substring “val”.

E:nth-child(An+B)

Matches any E element which is Bth child of an parent element after all its children have been split into groups of A elements each. A and B are integer numbers.

E:nth-last-child(An+B)

Matches any E element which is Bth child of an parent element after all its children have been split into groups of A elements each and counting from last to first direction.

H-SMILE Specific Selectors

E:current

Matches “current” elements, e.g. this selector matches current <option> in <select> element.

E:checked

Matches checked elements. E.g. checked <input type=checkbox> or <option> in <select multiple> element.

E:disabled

Matches disabled elements.

E:readonly

Matches read only input elements.

E:expanded and E:collapsed

Matches elements in expanded or collapsed states. E.g. <options> - nodes in tree-views (<select> elements).

E:incomplete

Matches img elements in incomplete state (while it downloads remote image).

E:focusable

Matches focusable input elements.

E:anchor

Matches anchor elements.

E:synthetic

Matches synthetic elements - elements synthesized by the engine, e.g. in some circumstances engine can create additional '<td>' elements to fill “holes”.

E:popup

Matches elements shown as popup windows.

E:owns-popup

Matches elements that has popup window shown for it.

E:focus

Matches input element in focus.

E:tab-focus

Matches input element in focus when it got focus by tab key traversal.

E:busy

Matches element for which engine is executing remote request. E.g. <frame> awaiting document to arrive has this state.

E:pressed

Matches element that is activated either by mouse or by keyboard key press.

h-smile/css-selectors.txt · Last modified: 2007/09/21 22:39 (external edit)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0