Styleswitchers

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 Says:

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

  2. kristine Says:

    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 Says:

    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. The Trommetter Times Says:
    Alternate Stylesheets
    The Scriptygoddess has some tips about how to implement alternate stylesheets. I’m starting slowly with alternate style sheets that

  5. Jennifer Says:

    Thank you!! :D (I’m using those as inspiration on the new design) (You know where the test area is… go check it out)

  6. kadyellebee Says:
    Styleswitchers
    I’ve been playing with code this morning. Some MT code, some DHTML for a contracting menu thingy I want to

  7. david Says:

    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?

  8. blog Says:
    Style Switcher
    Blog¤ò»Ï¤á¤ë¤ÈƱ»þ¤Ëµ¤¤Ë¤Ê¤Ã¤Æ¤¿¤Î¤¬¤³¤Î StyleSwitcher¡£ ˬÌä¼Ô¤¬¤½¤ì¤¾¤ì¹¥¤­¤Ê¥ì¥¤¥¢¥¦¥È¡¦¥Ç¥¶¥¤¥ó¤òÁª¤ó¤Ç±ÜÍ÷¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤È¤¤¤¦¤â¤Î¡£ ´ÉÍý¿Í¦¤Ï¡¢Ê£¿ô¤Î¥¹¥¿¥¤¥ë¥·¡¼¥È¤òÍѰդ·¤Æ¡¢¤½¤ì¤Ë¥ê¥ó¥¯¤òޤì¤Ð¤¤¤¤¤À¤±¤Ê¤Î¤Ç¡¢ÌÏÍÍÂØ¤¨Ëâ¤Î»ä¤Ë¤Ï¤â¤Ã¤Æ¤³¤¤¤Î¤¢…

  9. blog Says:
    Style Switcher
    Blog¤ò»Ï¤á¤ë¤ÈƱ»þ¤Ëµ¤¤Ë¤Ê¤Ã¤Æ¤¿¤Î¤¬¤³¤Î StyleSwitcher¡£ ˬÌä¼Ô¤¬¤½¤ì¤¾¤ì¹¥¤­¤Ê¥ì¥¤¥¢¥¦¥È¡¦¥Ç¥¶¥¤¥ó¤òÁª¤ó¤Ç±ÜÍ÷¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤È¤¤¤¦¤â¤Î¡£ ´ÉÍý¿Í¦¤Ï¡¢Ê£¿ô¤Î¥¹¥¿¥¤¥ë¥·¡¼¥È¤òÍѰդ·¤Æ¡¢¤½¤ì¤Ë¥ê¥ó¥¯¤òޤì¤Ð¤¤¤¤¤À¤±¤Ê¤Î¤Ç¡¢ÌÏÍÍÂØ¤¨Ëâ¤Î»ä¤Ë¤Ï¤â¤Ã¤Æ¤³¤¤¤Î¤¢…

  10. blog Says:
    Style Switcher
    Blog¤ò»Ï¤á¤ë¤ÈƱ»þ¤Ëµ¤¤Ë¤Ê¤Ã¤Æ¤¿¤Î¤¬¤³¤Î StyleSwitcher¡£ ˬÌä¼Ô¤¬¤½¤ì¤¾¤ì¹¥¤­¤Ê¥ì¥¤¥¢¥¦¥È¡¦¥Ç¥¶¥¤¥ó¤òÁª¤ó¤Ç±ÜÍ÷¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤È¤¤¤¦¤â¤Î¡£ ´ÉÍý¿Í¦¤Ï¡¢Ê£¿ô¤Î¥¹¥¿¥¤¥ë¥·¡¼¥È¤òÍѰդ·¤Æ¡¢¤½¤ì¤Ë¥ê¥ó¥¯¤òޤì¤Ð¤¤¤¤¤À¤±¤Ê¤Î¤Ç¡¢ÌÏÍÍÂØ¤¨Ëâ¤Î»ä¤Ë¤Ï¤â¤Ã¤Æ¤³¤¤¤Î¤¢…

  11. marc Says:

    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

  12. Thinks Too Much Says:

    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

  13. iNeusch.com Says:
    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….

  14. eric Says:

    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.