HTML and CSS Reference
In-Depth Information
Browser Support for Selectors
Browser support for the selectors described in this chapter is great in
some cases and just starting to get there for other cases. Selectors such
as type, ID, class, and links are supported everywhere. CSS2 and CSS3 selec-
tors such as attributes and some of the combinators such as + and > are
supported widely enough to be useful on many projects. Peter-Paul Koch
maintains some useful support charts for selectors in desktop browsers
( http://www.quirksmode.org/css/contents.html ) and mobile browsers
( http://www.quirksmode.org/m/css.html ).
Grouping Selectors
Different selectors can be separated by a comma and be assigned the
same properties. This will allow you to cut down on repeated use of the
same properties, keep your layouts more uniform, and make changes and
small tweaks easier.
p, blockquote, ul, li, dl {
padding: 0;
margin: 0 1em 1.5em;
}
This statement gives many block-level elements that may appear in the
content areas of your document the same whitespace.
Selector Speed
The greater the complexity of selectors, in the form of chaining multiple
nodes or using sibling combinators or attribute selectors, the harder
the rendering engine needs to work when parsing the document and
drawing the page. Speed that is measured in milliseconds may not seem
like a factor in the performance of a web site, but tallied over a large
 
 
 
 
Search WWH ::




Custom Search