• 0

Dymanic Style Sheet Changing


Question

I ran across this feature in a website that I have no idea where to find any longer. You click a link and the sites .css is reloaded with a new one. Anyone know how this is achieved? Also, would it be possible to alter images as well using this method? I suspect so. I have a template design of a site I am working on and have 2 colored versions *blue and orange* and would like to be able the user to pick one that they prefered. Probably more hassle than its worth really.

Link to comment
https://www.neowin.net/forum/topic/114730-dymanic-style-sheet-changing/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

http://www.alistapart.com/articles/n4switch/

Images are possibly changed if you use a div to place a background image. I think that would be the best way. Then when you change stylesheets, the images go with it.

Check out this site as well: http://www.csszengarden.com/

The best showcase of how useful and versatile CSS can be.

  • 0

Firstly ... Hi all. I'm new to the forum, but I thought I'd give a little input to your question.

You can modify your site's CSS dynamically via some JavaScript code that will load the selected StyleSheet. There are a few examples on the web kicking around.

You can also change the images, etc by using this method, although it's a lot more complicated.

Now if your using a Server-Side language like PHP, ColdFusion, ASP etc, It's possible to "skin" your site allow the visitor to not only change the styles of the site, but reload the whole site in a completely different layout.

For example:

On my site (ScriptDaddy.NET), if you select the skins links, you have the option to choose either Skin 1 or Skin 2. By selecting Skin 2, it will reload the site in a new style and will save the style to a cookie.

The code behind it depends on the Server-Side code you are using. I can help you out with both PHP and ColdFusion code, if you like.

I hope this helps

Ben aka ScriptDaddy!

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.