dinky pocket book # CSS Selectors
--- --- ## Simple selectorsassume throughout that `E` and `F` are elements, they can have attribute `foo` e.g.
you can replace these with any elements or attributes.
In HTML, elements in CSS can be uppercase like these examples. In XHTML, elements must be lower case. Classes and IDs are **always** case sensitive
**universal selector**, match any element `*` **type** (or element) selector `E` **ID selector** an E element with ID equal to "myid", e.g. ``n` can be replaced with an expression in all following cases `n` can be (odd), (even) or expressions such as (3n + 1)
an E element, the n-th child of its parent `E:nth-child(n)` an E element, the n-th child of its parent, counting from the last one `E:nth-last-child(n)` an E element, the n-th sibling of its type `E:nth-of-type(n)` an E element, the n-th sibling of its type, counting from the last one `E:nth-last-of-type(n)` an E element that is the document root, i.e. html `E:root` --- --- ## Structural pseudo-classes an E element, first child of its parent `E:first-child` an E element, first sibling of its type `E:first-of-type` an E element, last child of its parent `E:last-child ` an E element, last sibling of its type `E:last-of-type` an E element, only child of its parent `E:only-child` an E element, only sibling of its type `E:only-of-type` an E element that has no children (including text nodes) `E:empty` --- --- ## Pseudo-classes matches a link E when E is a link and not visited, hovered over focused on or active `E:link` the href target of the link E has been visited `E:visited` the link E has been activated `E:active` any element E when hovered over with a mouse `E:hover` the link or form control E when tabbed to with a keyboard `E:focus` element E is the fragment in the referring URI `E:target` an element of type E in language "fr" `E:lang(fr)` --- --- ## Forms & Pseudo-elements a user interface element E which is enabled `E:enabled` a user interface element E which is disabled `E:disabled` a user interface element E which is checked `E:checked` the first formatted line of an E element `E::first-line` the first formatted letter of an E element `E::first-letter` generated content before an E element `E::before` generated content after an E element `E::after`http://www.w3.org/TR/css3-selectors/