scriptygoddess

28 Oct, 2002

Styleswitchers

Posted by: kristine In: CSS

Allowing for multiple stylesheets has never been so easy! Mozilla has a built in style changer (when you reference the alternate stylesheets correctly), but the other browsers don't. A List Apart put together a tutorial and a javascript styleswitcher a while back, and more recently, they added a PHP switcher.

Alternative Style: Working with Stylesheets – it explains how the script work, and then allows you to download it. It also gives examples of how to use it in your coding.

Build a PHP Switcher – gives a full tutorial on how to write up the code and the stylesheets to work with it. I originally saw a less polished tutorial of this on my css-d list: Backward-compliant style switcher (in PHP)

I have the javascript version working on the sidebar of my 1st skin on my blog: check out alt:colors on the sidebar. I look forward to playing with the PHP version because it will work even when Javascript is turned off on the browser.

14 Responses to "Styleswitchers"

1 | Jason

October 29th, 2002 at 9:08 am

Avatar

OK, maybe I missed it. How do you use the style changer in Mozilla? Do you have any links?

2 | kristine

October 29th, 2002 at 9:24 am

Avatar

If you go to my skin 1 site linked above with Mozilla, you can go to the View menu — Use Style — and it gives you all of the options :)

There's some info for this at CSS Lost + Found, although I followed the A List Apart tutorial above to get mine :)

3 | MJI Brower

October 29th, 2002 at 9:29 am

Avatar

Interesting… back in July I did almost the exact thing they describe in the ALA article to my portfolio to allow users to choose a theme (and show off my PHP skills, of course… it *is* my portfolio :-) ). Wish I had had that article!

4 | Jennifer

October 29th, 2002 at 11:17 am

Avatar

Thank you!! ๐Ÿ˜€
(I'm using those as inspiration on the new design) (You know where the test area is… go check it out)

5 | david

February 21st, 2003 at 9:31 am

Avatar

I've implemented the php switcher from A List Apart, and it works fine for my index and archive templates. However, my Comment Listing, Comment Preview, Comment Error, and Trackback Listing templates are not recognizing the stylesheets, even though I pasted the stylesheet link into them. Any ideas what would be causing this?

6 | marc

November 26th, 2003 at 2:16 am

Avatar

I'am trying to use the style switcher and have checked both Paul Sowden's and A List Apart to answer my question.

Where do I place the actual javascript js. Does it go into the head of each page or is it linked remotely?

Thanks

7 | Thinks Too Much

January 13th, 2004 at 6:30 pm

Avatar

I wrote Chris about extensions to his switcher, and he pointed me toward someone else's code entirely:

"To answer your question, I'm simply going to cut'n'paste something I wrote some nine months ago concerning my switcher.. and then expand on
it. Here:

…I thoroughly recommend Rob Ballou's adaptation of the code instead.
Why would I willfully shun my own code? To be perfectly honest, the hook of that article was the "just five lines of code" mentioned in the blurb. I can assure you that a more secure, more thorough script takes much more than five lines of code; but every article (like every song) needs a hook. The brevity of code in my switcher was mine. Brevity is, after all, the soul of wit.'

Over time, Rob Ballou's adaptation of my switcher has evolved.. evolved to become precisely what you're looking for. v2 supports multiple style sheet switching, so you can indeed control many elements of your page layout independent of one another. Check it out."

http://www.contrastsweb.com/switcher/v2/

-Chris

8 | eric

May 5th, 2004 at 12:31 pm

Avatar

If you have the new search windows added to your tool bar, (like the google search tool for example)it makes the auto fill form fields turn yellow. Is their a way to make my form css over ride the auto fill color change.

9 | The Trommetter Times

October 29th, 2002 at 10:41 am

Avatar

Alternate Stylesheets
The Scriptygoddess has some tips about how to implement alternate stylesheets. I'm starting slowly with alternate style sheets that

10 | kadyellebee

October 29th, 2002 at 1:40 pm

Avatar

Styleswitchers
I've been playing with code this morning. Some MT code, some DHTML for a contracting menu thingy I want to

11 | blog

September 2nd, 2003 at 3:41 pm

Avatar

Style Switcher
Blogยครฒยปรยครกยครซยครˆร†ยฑยปรพยคร‹ยตยคยคร‹ยครŠยครƒยคร†ยคยฟยครŽยคยฌยคยณยครŽ StyleSwitcherยกยฃ ร‹ยฌรŒรคยผร”ยคยฌยคยฝยครฌยคยพยครฌยนยฅยคยญยครŠยฅรฌยฅยคยฅยขยฅยฆยฅรˆยกยฆยฅร‡ยฅยถยฅยคยฅรณยครฒรยชยครณยคร‡ยฑรœรรทยคยนยครซยคยณยครˆยคยฌยคร‡ยคยญยครซยครˆยคยคยคยฆยครขยครŽยกยฃ ยดร‰รรฝยฟรร‚ยฆยครยกยขรŠยฃยฟรดยครŽยฅยนยฅยฟยฅยคยฅรซยฅยทยกยผยฅรˆยครฒรร‘ยฐร•ยคยทยคร†ยกยขยคยฝยครฌยคร‹ยฅรชยฅรณยฅยฏยครฒร…ยฝยครฌยครยคยคยคยคยคร€ยคยฑยครŠยครŽยคร‡ยกยขรŒรรรร‚ร˜ยคยจร‹รขยครŽยปรคยคร‹ยครยครขยครƒยคร†ยคยณยคยคยครŽยคยข…

12 | blog

September 3rd, 2003 at 3:04 am

Avatar

Style Switcher
Blogยครฒยปรยครกยครซยครˆร†ยฑยปรพยคร‹ยตยคยคร‹ยครŠยครƒยคร†ยคยฟยครŽยคยฌยคยณยครŽ StyleSwitcherยกยฃ ร‹ยฌรŒรคยผร”ยคยฌยคยฝยครฌยคยพยครฌยนยฅยคยญยครŠยฅรฌยฅยคยฅยขยฅยฆยฅรˆยกยฆยฅร‡ยฅยถยฅยคยฅรณยครฒรยชยครณยคร‡ยฑรœรรทยคยนยครซยคยณยครˆยคยฌยคร‡ยคยญยครซยครˆยคยคยคยฆยครขยครŽยกยฃ ยดร‰รรฝยฟรร‚ยฆยครยกยขรŠยฃยฟรดยครŽยฅยนยฅยฟยฅยคยฅรซยฅยทยกยผยฅรˆยครฒรร‘ยฐร•ยคยทยคร†ยกยขยคยฝยครฌยคร‹ยฅรชยฅรณยฅยฏยครฒร…ยฝยครฌยครยคยคยคยคยคร€ยคยฑยครŠยครŽยคร‡ยกยขรŒรรรร‚ร˜ยคยจร‹รขยครŽยปรคยคร‹ยครยครขยครƒยคร†ยคยณยคยคยครŽยคยข…

13 | blog

September 3rd, 2003 at 1:11 pm

Avatar

Style Switcher
Blogยครฒยปรยครกยครซยครˆร†ยฑยปรพยคร‹ยตยคยคร‹ยครŠยครƒยคร†ยคยฟยครŽยคยฌยคยณยครŽ StyleSwitcherยกยฃ ร‹ยฌรŒรคยผร”ยคยฌยคยฝยครฌยคยพยครฌยนยฅยคยญยครŠยฅรฌยฅยคยฅยขยฅยฆยฅรˆยกยฆยฅร‡ยฅยถยฅยคยฅรณยครฒรยชยครณยคร‡ยฑรœรรทยคยนยครซยคยณยครˆยคยฌยคร‡ยคยญยครซยครˆยคยคยคยฆยครขยครŽยกยฃ ยดร‰รรฝยฟรร‚ยฆยครยกยขรŠยฃยฟรดยครŽยฅยนยฅยฟยฅยคยฅรซยฅยทยกยผยฅรˆยครฒรร‘ยฐร•ยคยทยคร†ยกยขยคยฝยครฌยคร‹ยฅรชยฅรณยฅยฏยครฒร…ยฝยครฌยครยคยคยคยคยคร€ยคยฑยครŠยครŽยคร‡ยกยขรŒรรรร‚ร˜ยคยจร‹รขยครŽยปรคยคร‹ยครยครขยครƒยคร†ยคยณยคยคยครŽยคยข…

14 | iNeusch.com

April 7th, 2004 at 11:28 am

Avatar

CSS Switcher
I'm going to add a CSS Switcher to the site. This is the only way I found to stop those "I don't like your colors comments" ๐Ÿ˜‰ Info about what I'm going to use in the Trackback….

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements