CSS-селекторы

PatternMeaningTypeCSS levelSupport
*any elementUniversal selector2IE7+
Ean element of type EType selector1All
E[foo]an E element with a "foo" attributeAttribute selectors2IE7+
E[foo="bar"]an E element whose "foo" attribute value is exactly equal to "bar"Attribute selectors2IE7+
E[foo~="bar"]an E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar"Attribute selectors2IE7+
E[foo^="bar"]an E element whose "foo" attribute value begins exactly with the string "bar"Attribute selectors3IE7+
E[foo$="bar"]an E element whose "foo" attribute value ends exactly with the string "bar"Attribute selectors3IE7+
E[foo*="bar"]an E element whose "foo" attribute value contains the substring "bar"Attribute selectors3IE7+
E[foo|="en"]an E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en"Attribute selectors2IE7+
E:rootan E element, root of the documentStructural pseudo-classes3IE9+
E:nth-child(n)an E element, the n-th child of its parentStructural pseudo-classes3IE9+
E:nth-last-child(n)an E element, the n-th child of its parent, counting from the last oneStructural pseudo-classes3IE9+
E:nth-of-type(n)an E element, the n-th sibling of its typeStructural pseudo-classes3IE9+
E:nth-last-of-type(n)an E element, the n-th sibling of its type, counting from the last oneStructural pseudo-classes3IE9+
E:first-childan E element, first child of its parentStructural pseudo-classes2IE7+
E:last-childan E element, last child of its parentStructural pseudo-classes3IE9+
E:first-of-typean E element, first sibling of its typeStructural pseudo-classes3IE9+
E:last-of-typean E element, last sibling of its typeStructural pseudo-classes3IE9+
E:only-childan E element, only child of its parentStructural pseudo-classes3IE9+
E:only-of-typean E element, only sibling of its typeStructural pseudo-classes3IE9+
E:emptyan E element that has no children (including text nodes)Structural pseudo-classes3IE9+
E:link
E:visited
an E element being the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited)The link pseudo-classes1All
E:active
E:hover
E:focus
an E element during certain user actionsThe user action pseudo-classes1 and 2All
E:targetan E element being the target of the referring URIThe target pseudo-class3IE9+
E:lang(fr)an element of type E in language "fr" (the document language specifies how language is determined)The :lang() pseudo-class2IE8+
E:enabled
E:disabled
a user interface element E which is enabled or disabledThe UI element states pseudo-classes3IE9+
E:checkeda user interface element E which is checked (for instance a radio-button or checkbox)The UI element states pseudo-classes3IE9+
E::first-linethe first formatted line of an E elementThe ::first-line pseudo-element1IE8+
E::first-letterthe first formatted letter of an E elementThe ::first-letter pseudo-element1IE8+
E::beforegenerated content before an E elementThe ::before pseudo-element2IE8+
E::aftergenerated content after an E elementThe ::after pseudo-element2IE8+
E.warningan E element whose class is "warning" (the document language specifies how class is determined).Class selectors1All
E#myidan E element with ID equal to "myid".ID selectors1All
E:not(s)an E element that does not match simple selector sNegation pseudo-class3IE9+
E Fan F element descendant of an E elementDescendant combinator1All
E > Fan F element child of an E elementChild combinator2IE7+
E + Fan F element immediately preceded by an E elementAdjacent sibling combinator2IE7+
E ~ Fan F element preceded by an E elementGeneral sibling combinator3IE7+