Call SEO0845 838 7448 SEO RSS Feed

Switching Style Sheets (Part II)

May 272007

published by Dan in CSS with No Comments

In the previous post i tried to setup the knowledge foundation in creating dynamically switching style sheets. I discussed the three different relationships that external style sheets have to your document: persistent, preferred and alternate.

So how does the style sheet switching mechanism work? When a web document is initially loaded, the persistent and preferred style sheets are applied to the document. Alternate style sheets can be selected by the user to change the formatting of the page. According to the W3C, this style sheet switching should be done through the browser, through a browser feature. While Mozilla (Firefox and Semonkey) and Opera browsers provide this feature, Internet Explorer unfortunately does not. So we end up with alternate style sheets but no way of accessing them through Internet Explorer.

With Javascript along with the DOM, we can create a script to provide a cross-platform way for users to select the style sheet that they want to use. In order not to break the style switcher feature of Mozilla browsers, we should use the link tags according to the rules of the W3C. Then we can use cookies to store the users’ style sheet preference. This way, the choice is reflected in the whole site and not just in one page.

Now that I have explained the background of style sheet switching, I will discuss next how to implement the actual Javascript.

AddThis Social Bookmark ButtonAddThis Feed Button

RSS feed | Trackback URI

No responses to Switching Style Sheets (Part II)

No comments yet.

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.

SEO Services | SEO Firm | SEO Consultant | UK Search Engine Optimisation | Search Engine Optimisation Services | Search Engine Marketing | Pay-Per-Click
Internet Marketing SEO | SEO Company | SEO Service | SEO Companies | SEO Promotion | SEO Strategy | SEO Peterborough | SEO Ranking