Barbara Leeds > Samples >
If you use a stylesheet, you must connect it to the document with one of three connection methods, indicated in the document head:
Linked | Imported | Internal/Embedded/Document |
---|---|---|
<head> <link type="text/css" href="url" rel="stylesheet"> </head> |
<head> <style type="text/css"> <!--@import url(url);--> </style> </head> |
<head> <style type="text/css"> <!--rules--> </style> </head> |
Instead of connecting an entire stylesheet to an entire document, you could apply a single CSS rule to a single tag within the document. For syntax, see “Inline Styles” in “CSS vs. HTML: Style Syntax Comparison.”
In the second and third columns of the table, I comment out the statements within the <style> container, to hide them from old browsers. Using this tactic has some risk; not using it has more risk. (See “Bringing CSS and HTML Together,” page 16, in Meyer’s book.)
This document appeared for many years
on the Silicon Valley WebGuild website.
barbaraleeds@yahoo.com, 8-17-2006 |