Working with Alternate Stylesheets

Persistent, Preferred, Alternate, and Media Targeted CSS

 
 
Working with Alternate Stylesheets

Update: June 2012 -  This document was intended to be a supporting document for a yet unfinished "style switching" theme which has been delayed until 2013; after the release of RavenNuke 3.0. Our apologies, but this document will remain incomplete until then...


In preparation for the upcoming release of our style switching theme Chameleon, we would like to give a quick overview of how alternate stylesheets work; so that others can modify, customize, and build upon the Chameleon framework. CSS stylesheets can relate to your document in several different ways; but for now let's concern ourselves with persistent and alternate stylesheets.

Persistent stylesheets are your normal, everyday stylesheets that are always enabled. They are defined by setting the rel attribute to “StyleSheet” and have NO title attribute.
 

<link rel="StyleSheet" href="./themes/ravennuke.css" type="text/css" />

Alternate stylesheets allow users to switch the page style dynamically, and are defined by setting the rel attribute to “Alternate StyleSheet” and naming it with a title attribute.

<link rel="Alternate StyleSheet" href="./themes/Chameleon/style/styles1.css" type="text/css" title="styles1" media="screen" />

Alternate stylesheets work in coordination with your persistent stylesheets, allowing you to override any previously declared CSS definitions. Any styling that is not declared in the selected alternate stylesheet will default to what has already been declared in your persistent stylesheets. So for instance, if all you wanted to do was change the background and text colors, your alternate stylesheet could be as simple as:

body {
 background-color: #000000;
 color: #ffffff;
}

Of course it is doubtful your alternate stylesheet will be that simple, but the point being you don't have to re-declare all of your styling; only that which you want to change. This also means that alternate stylesheets will NOT work as persistent stylesheets. For instance, if you decide you like one of your alternate styles better than your default style, you would have to use a tool like WinMerge or CSSMerge to merge your changes into your main persistent stylesheet.

 
 
 
 
 
 
Comments powered by Disqus
 
 
Posted: November 20, 2010 12:39 PM EST   Category: RavenNuke Tweaks and Tips   15580 Reads
 
 
Exuberanza Scripts
 
 

Site Info

Server TrafficServer Traffic
  • Total: 6,558,979
  • Today: 5,272
Server InfoServer Info
  • Nov 22, 2017
  • 08:00 pm UTC