HTML and CSS Reference
In-Depth Information
comment ( <!-- ) tag. Older, style-free browsers ignore the <style> tag,
but then blithely go on to display its contents. Current browsers expect
style rules to appear within an HTML comment and process them ac-
cordingly, whereas older browsers appropriately ignore the unrecog-
nized <style> tag and go on to treat the comment tag and its intervening
text normally. That works.
The order of the tags is very important. Here's the approach, which you
may have noticed in our document-level style example:
h1 {color: blue; font-style: italic}
Use a <style> tag, followed by an HTML comment, then followed by the
document-level style rule(s). Finally, in order, close the comment and
the </style> tag.
XHTML documents require a slightly different approach. In those docu-
ments, we enclose document-level styles in a CDATA section rather than
an HTML comment tag. See section 16.3.7 for details.
Also, as they do for other attributes they don't recognize, the style-free
browsers ignore inline style attributes and their values, so there are no
detrimental effects in that regard for your document displays.
8.1.4. External Stylesheets
You can also place style definitions into a separate document (a text file
with the Multipurpose Internet Mail Extension, or MIME, type of text/
css ) and import this external stylesheet into your document. Use the
same stylesheet for other documents in your collection, too, even entire
collections of documents, to achieve a consistent look and feel. Because
an external stylesheet is a separate file and the browser loads it over
Search WWH ::

Custom Search