Headings: [Skip]

Web-Design Tutorials by Dr Sam

CSS, the Cascade

Menu [Skip]

Combinations and Precedence

Reasons for Combinations

Imagine someone who is designing a number of inter-related web-pages for a web-site:

  1. The designer wants the same styles to apply to all of the pages generally.
    • So, the designer links all of the pages to a external style sheet.

  2. The designer wants a particular page to have some special effects of its own, different from the rest of the pages
    • So, the designer includes document level styles specially into the head of this page.

  3. The designer wants some elements, not all, to have particular styles of their own, such as italics or bold or center-alignment, etc.
    • So, the designer creates classes of styles and/or id styles.
    • They will be set specially into some tags, and they will take precedence, replacing any conflicting styles higher in the cascade.