PageResource.com - Web Development Tutorials

CSS3 List of New Selectors

CSS3 introduces several new selectors. Below is a list of these selectors. In the tutorial to follow we will look at several of these selectors in detail.

 

Pattern Meaning
E[foo^="bar"] an E element whose “foo” attribute value begins exactly with the string “bar”
E[foo$="bar"] an E element whose “foo” attribute value ends exactly with the string “bar”
E[foo*="bar"] an E element whose “foo” attribute value contains the substring “bar”
E:root an E element, root of the document
E:nth-child(n) an E element, the n-th child of its parent
E:nth-last-child(n) an E element, the n-th child of its parent, counting from the last one
E:nth-of-type(n) an E element, the n-th sibling of its type
E:nth-last-of-type(n) an E element, the n-th sibling of its type, counting from the last one
E:last-child an E element, last child of its parent
E:first-of-type an E element, first sibling of its type
E:last-of-type an E element, last sibling of its type
E:only-child an E element, only child of its parent
E:only-of-type an E element, only sibling of its type
E:empty an E element that has no children (including text nodes)
E:target an E element being the target of the referring URI
E:enabled
E:disabled
a user interface element E which is enabled or disabled
E:checked a user interface element E which is checkedĀ (for instance a radio-button or checkbox)
E:not(s) an E element that does not match simple selector s
E ~ F an F element preceded by an E element

Leave a Reply


Copyright © The Web Design Resource. All rights reserved. | Contact Us | Privacy Policy