Call SEO0845 838 7448 SEO RSS Feed

Switching Style Sheets (Part I)

May 252007

published by Dan in CSS with 1 Comment

Using CSS to control what your website looks like is the first step towards a good website design. To give more options to your users, you may implement way to dynamically switch between different style sheets.As you know, external stylesheets can be associated with documents using a list of link elements in the head. Three different relationships exist between your document and external stylesheets: persistent, preferred, and alternate.

Persistent
Persistent stylesheets are enabled and are combined with the current active stylesheet of the document. Persistent stylesheets can be used to apply a fixed and common style to all stylesheets. To make a style sheet persistent, set the rel attribute to “style sheet” and don’t set the title attribute

Example:

<link rel="stylesheet"
type="text/css" href="example.css" />

Preferred
Preferred style sheets are enabled when the document is first loaded. They can be disabled if the users selects an alternate style sheet. To make a style sheet preferred, set the rel attribute to “style sheet” and name the style sheet with the title attribute.

Example:

<link rel="stylesheet"
type="text/css" href="example.css"
title="Default_Style" />

You can also group multiple style sheets by naming them using the same title attribute. If more than one type of preferred style sheet is specified, the type declared first takes precedence.

Alternate
Alternate style sheets are not enabled by default but they can be selected by the user as alternatives to the preferred style sheet. To specify an alternate style sheet, set the rel attribute to “alternate stylesheet” and name the style sheet with the title attribute.

Example:

<link rel="alternate stylesheet"
type="text/css" href="example.css"
title="alternate_style" />

Next post I will continue with ways of implementing the style sheet switching mechanism.

AddThis Social Bookmark ButtonAddThis Feed Button

RSS feed | Trackback URI

One response to Switching Style Sheets (Part I)

2007-05-29 17:35:36

[...] is the third part of a series of post on dynamic switching of style sheets. The first post discussed the basic CSS knowledge required, and the second post discussed the background on style sheet switching and why it has to [...]

(Comments wont nest below this level.)

 

Leave a reply


You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Web Design | Graphic Design | SEO | SME Website Design | E-commerce Systems | Website Applications | Website maintenance Website Copywriting
Graphic Design | Corporate Identity and Branding | Logo Design | Search Engine Optimisation | Free SEO assessment | Website Design Peterborough | Graphic Design Peterborough Web Design Bolg

© 2007 Doublespark Limited - All rights reserved.

This site is protected by Copyscape