This excerpt is from CSS Cookbook, Third Edition.
Learn how to solve the real problems you face with CSS. This cookbook offers hundreds of practical examples for using CSS to format your web pages, and includes code samples you can use right away. You'll find exactly what you need, from determining which aspects of CSS meet the specific needs of your site to methods for resolving differences in the way browsers display it.
Although CSS3 is still being worked on as this book is being written, some browser vendors are starting to support properties from the unfinished specification. This appendix provides a listing of the new CSS3 selectors for your reference.
To get a solid idea of what tools you have at your disposal to apply styles to a document, consult Appendix C, CSS 2.1 Selectors, Pseudo-Classes, and Pseudo-Elements (which covers CSS 2.1 selectors) in conjunction with this listing.
Table D.1, “New CSS3 selector” describes the new CSS3 selector, the general sibling selector.
In the “Generic pattern” column of Table D.1, “New CSS3 selector”, the values C,
R, and S take the place of type
selectors.
Table D.2, “CSS3 attribute selectors” contains a list of new attribute selectors. These allow greater control when selecting elements in a document based on an attribute’s value or even a small portion of that value.
Table D.2. CSS3 attribute selectors
|
Selector |
Generic pattern |
Description |
Sample |
|---|---|---|---|
|
|
Selects any
|
| |
|
Attribute selector |
|
Selects any
|
|
|
Attribute selector |
|
Selects any
|
|
|
Attribute selector |
|
Selects any
|
|
Table D.3, “CSS3 structural pseudo-classes” contains a list of
structural pseudo-elements. These allow you to pick out elements based on
their order. For example, you can pinpoint the odd-numbered
li elements using the nth-child
selector instead of using the class attribute
selector.
Table D.3. CSS3 structural pseudo-classes
If you enjoyed this excerpt, buy a copy of CSS Cookbook, Third Edition.
Copyright © 2009 O'Reilly Media, Inc.