Cascading Styles

After all this discussion of Cascading Style Sheets (CSS), you might be wondering about the meaning of the term cascading. The CSS specification allows multiple style sheets to affect one document. Most of the time, the Web page creator specifies these style sheets. Users of some browsers (including Internet Explorer) can also create personal style sheets that affect the layout of the page—for example, by increasing the size or the color of text. When multiple style sheets interact, they are said to cascade with one another.

Obviously, conflicts can come up when various style sheets act on one document. In some browsers, the author's styles take precedence over the user's styles, while this is reversed in other browsers. Both author and user styles take precedence over default styles. When multiple author styles interact, the style referenced last generally takes precedence.

If you want to give additional weight to a particular style definition, you can append an important declaration to the definition as follows:

 H2 {color: red!important; font-style: italic} 

Notice the exclamation point that must be included between the style definition and the word important. Any definition without an important declaration is considered to be of normal weight. Style definitions with important declarations always take precedence over definitions of normal weight, regardless of who authored the definitions. Netscape Navigator does not currently support the important declaration.



Dynamic HTML in Action
Dynamic HTML in Action
ISBN: 0735605637
EAN: 2147483647
Year: 1999
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net