What’s New in CSS2 423
CSS
What’s New in CSS2
Web Design in a Nutshell, eMatter Edition
CSS2 incorporates and refines the set of properties used for positioning to give
designers more control over page layout and DHTML authors the ability to create
dynamic motion effects.
It provides more controls over traditional typesetting elements such as widows,
orphans, and page breaks. This shows that style sheets are being developed with a
mind to developing documents for both HTML display and print output.
CSS2 also introduces properties that give additional control over table element
presentation.
As part of the W3C’s efforts to make web pages accessible to all users, the latest
style sheet specification includes a number of new properties that pertain to the
nonvisual display of web pages. These new attributes provide controls for speech-
delivery and sound controls.
The following list of new CSS2 elements was compiled and graciously contributed
to this book by CSS-guru Eric Meyer. It reflects the state of the final CSS2 specifica-
tion, which was made a W3C Recommendation in May 1998.
New Selectors
The following are the new CSS2 selectors:
Selector Description
* Matches any element.
Example:*{font-family:serif;}
A>B Matches any element B that is a child of any element A.
Example:DIV.main>P{line-height:1.5;}
A+B Matches any element B that immediately follows any
element A.
Example:P+UL{margin-top:0;}
A[att] Matches any element A that has the given attribute
defined, whatever its value.
Example:TABLE[border]{background-color:white;}
A[att="val"] Matches any element B that has the specified attribute set
to the specified value.
Example:TABLE[border="3"]{background-
color:yellow;}
A[att~="val"] Matches any element B that has the specified value as one
of the values in a list given to the specified attribute.
Example:TABLE[class~="example"]{background-
color:orange;}
A[lang|="val"] Matches any element A that has the given value as one of
the values for thelang attribute.
Example:P[lang|="en"]{text-align:left;}