Multi-Page Strategies

When we have several pages using the same styles and JavaScript, we can:

1. Duplicate the styles into the tags on all the pages

This strategy will certainly work, but it defeats the purpose of style sheets - the ability to separate style from content.

2. Use JavaScript to set initial conditions

We could set all the <div>s to be invisible in the style sheet, and then explicitly set all the initial style attributes from a shared JavaScript .js file. This is a reasonable solution when every page starts out in the same initial state.

3. Access Style Objects in a Stylesheet

If we can find a way to access the styles that are in the stylesheet, we have the greatest flexibility; we can use a style across multiple pages, and, since we can access them from JavaScript, we can read the initial conditions rather than use fixed code to set them.

  Where Properties Reside  Index Accessing Style Sheets