HTML and CSS Reference
In-Depth Information
and */ markers, as we did in the example in section 8.1.2 , earlier in this
chapter. (Those of you who are familiar with the C programming lan-
guage will recognize these comment markings.) Use this comment syn-
tax for both document-level and external stylesheets. Comments cannot
be nested.
We recommend documenting your styles whenever possible, especially
in external stylesheets. Whenever the possibility exists that other au-
thors may use your styles, comments make it much easier to under-
stand your styles.
8.1.9. Style Precedence
You may import multiple external stylesheets and combine them with
document-level and inline style effects in many different ways. Their ef-
fects cascade (hence the name, of course). You may specify the font
type for our example <h1> tag, for instance, in an external style defini-
tion, whereas its color may come from a document-level stylesheet.
Stylesheet effects are not cumulative, however: of the many styles that
may define different values for the same propertycolors for the contents
of our example tag, for instancethe one that takes precedence can be
found by following these rules, listed here in order:
Sort by origin
A style-defined "closer" to a tag takes precedence over a more "dis-
tant" style; an inline style takes precedence over a document-level
style, which takes precedence over the effects of an external style.
If more than one applicable style exists, sort by class
A property defined as a class of a tag (see section 8.3 , later in this
chapter) takes precedence over a property defined for the tag in
general.
 
Search WWH ::




Custom Search