HTML and CSS Reference
In-Depth Information
Using the CSS2 model, the browser should prompt the user to choose
sheet1.css
or
sheet2.css
. It should then load the selected sheet, fol-
lowed by
sheet3.css
and
sheet4.css
. Duplicate styles defined in
sheet3.css
or
sheet4.css
, and in any inline styles, override styles defined
in the selected sheet. In practice, the popular browsers cascade the
stylesheet rules as defined in the example order
sheet1
through
sheet4
.
8.1.7. Limitations of Current Browsers
All the popular browsers support the
<link>
tag to apply an external
stylesheet to a document. None supports multiple, user-selectable
<link>
stylesheets, as proposed by the CSS2 standard. Instead, they
treat the
<link>
stylesheets as they do
@import
or document-level styles,
by cascading the rules.
Netscape version 6, but not earlier versions, Internet Explorer versions
5 and later, as well as all versions of Opera and Firefox, honor the
@import
and the
@media
at-rules, for both document-level and external
sheets, allowing sheets to be nested.
Achieving media-specific styles through external stylesheets with earlier
Netscape browsers is hopeless. Assume, therefore, that most people
who have Netscape version 4 will render your documents on a common
PC screen, so make
screen
the default. Then embed all other media-spe-
cific styles, such as those for print or Braille, within
@media
at-rules so
that CSS-compliant agents properly select styles based on the rendering
medium.
Another alternative is to create media-specific
<style>
tags within each
document. Run, do not walk, away from that idea.
8.1.8. Style Comments
Comments are welcome inside the
<style>
tag and in external
stylesheets, but treat them differently than HTML comments:
stylesheets aren't HTML. Rather, enclose style comments between
/*