CSS3 选择器概览

下面这份CSS3 选择器表还属于w3c草案,但也可让我们先一睹CSS3 概貌。

 

Overview of CSS 3 selector syntax
Selector typePatternDescription
Substring matching attribute selectorE[att^=”val”]Matches any E element whose att attribute value begins with “val”.
Substring matching attribute selectorE[att$=”val”]Matches any E element whose att attribute value ends with “val”.
Substring matching attribute selectorE[att*=”val”]Matches any E element whose att attribute value contains the substring “val”.
Structural pseudo-classE:rootMatches the document’s root element. In HTML, the root element is always the HTML element.
Structural pseudo-classE:nth-child(n)Matches any E element that is the n-th child of its parent.
Structural pseudo-classE:nth-last-child(n)Matches any E element that is the n-th child of its parent, counting from the last child.
Structural pseudo-classE:nth-of-type(n)Matches any E element that is the n-th sibling of its type.
Structural pseudo-classE:nth-last-of-type(n)Matches any E element that is the n-th sibling of its type, counting from the last sibling.
Structural pseudo-classE:last-childMatches any E element that is the last child of its parent.
Structural pseudo-classE:first-of-typeMatches any E element that is the first sibling of its type.
Structural pseudo-classE:last-of-typeMatches any E element that is the last sibling of its type.
Structural pseudo-classE:only-childMatches any E element that is the only child of its parent.
Structural pseudo-classE:only-of-typeMatches any E element that is the only sibling of its type.
Structural pseudo-classE:emptyMatches any E element that has no children (including text nodes).
Target pseudo-classE:targetMatches an E element that is the target of the referring URL.
UI element states pseudo-classE:enabledMatches any user interface element (form control) E that is enabled.
UI element states pseudo-classE:disabledMatches any user interface element (form control) E that is disabled.
UI element states pseudo-classE:checkedMatches any user interface element (form control) E that is checked.
UI element fragments pseudo-elementE::selectionMatches the portion of an element E that is currently selected or highlighted by the user.
Negation pseudo-classE:not(s)Matches any E element that does not match the simple selector s.
General sibling combinatorE ~ FMatches any F element that is preceded by an E element.

 

 

posted @ 2010-08-05 10:23  大树的种子  阅读(321)  评论(0编辑  收藏  举报