Using multiple CSS?
Posted: 08 March 2006 11:52 AM   [ Ignore ]
Newbie
Rank
Total Posts:  1
Joined  2006-03-08

Hello.

I hope I’m in the right place.  I’d re-designing my companies website, and I’d like to use about 3 seperate CSS (high-contrast, Hi-Viz and normal) and would like to offer users the option of clicking a link to alter the stylesheet accordingly, but also for it to stay on that stylesheet throughout the website so they don’t have to keep clicking the link.

I have seen a website which offers this, but I can’t find any info on the net.  Can anyone help?

Profile
 
 
Posted: 09 March 2006 06:40 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  17
Joined  2006-03-09

hi
maybe this will help:
http://www.ecst.csuchico.edu/~bertucci/csci245/styleswitcher.htm

Profile
 
 
Posted: 09 March 2006 07:25 PM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
Rank
Total Posts:  16
Joined  2004-05-22

Another style sheet switcher to try is: http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm

Profile
 
 
Posted: 14 March 2006 11:32 PM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  11
Joined  2006-03-14

Hi there!
styleswitcher
I use the above one on my site, you just download a js file and create links, there are directions on the site.. that one is really good I think and the same as the one istock use! The only problem with it is that sometimes there is a flash of the default stylesheet before the chosen one loads.. but if your not changing images I’d imagine it should be perfect! Good luck!

Profile
 
 
Posted: 03 April 2006 05:22 PM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  7
Joined  2006-04-03

You could always do it in php if you wanted to.

In our site, for example, a different style sheet and lay our is loaded up depending on the the resolution of the browser being used.

Profile
 
 
Posted: 03 April 2006 07:20 PM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  17
Joined  2006-03-09

php only, wo js? can we have a looksee please, id love to have it, have 0 php knowledge

Profile
 
 
Posted: 03 April 2006 07:24 PM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  7
Joined  2006-04-03

It depends on your needs.

We have different css files based on resolution sizes, each called res760.css, res940.css etc.

Then in the head we would have <link rel=“stylesheet” type=“text/css” href=”/res”.$resolution”.css” />

Of course it is ALOT more complicated than that, but that sums it up.

Profile
 
 
Posted: 04 April 2006 08:49 AM   [ Ignore ]   [ # 7 ]
Newbie
Rank
Total Posts:  17
Joined  2006-03-09

ive been ther on your site, and i see links only i dont understand where and what is the triger that would load each css ? and besides, it gave me one for 780 tho my resolution is 1020..and from what i can see, you have linked that html with 3 css files (main, left, 780px) and one .js, so wheres that php thingy?
this:

href="/res”.$resolution".css

i dont see anywhere

Profile
 
 
Posted: 04 April 2006 09:00 AM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  7
Joined  2006-04-03

Funny guy!

PHP is server side which means you can’t see it from the client-side.

Also, the code i gave in my post is just an example and not identical to that which we use.

Out of interest though, you said that your resolution is 1020. Could you see pictures of phones on the right hand side?

Profile
 
 
Posted: 04 April 2006 09:37 AM   [ Ignore ]   [ # 9 ]
Newbie
Rank
Total Posts:  17
Joined  2006-03-09

i realise that php is server side language, just thought that css is served by some php include directly to html. from what i can tell you are still using js to set up a cookie (and sniff for screen size?).
wasn’t trying to be funny or anything, its just i’m not big fan of .js and if there is php style switcher id love to have it -if it is available for all to use, of course, not copyrighted or something.

nope, i don’t get phones, not in FF. IE loads them, which is how i concluded that about cookie being crucial in whole story.

Profile
 
 
Posted: 04 April 2006 01:14 PM   [ Ignore ]   [ # 10 ]
Newbie
Rank
Total Posts:  7
Joined  2006-04-03

Honestly speaking, there are two css files for different resolutions.

For one reason or the other IE and FF are reacting differently on your side and if you open up the site using the two of them, you can see the source code and see the two different css files.

PHP is then being used as mentioned eariler.

With regards to the resolution sniffinf excercise, i would personally avoid it. You are experiencing yourslef how unreliable it is.

In any case, if you really want it, visit http://www.phpbuddy.com/article.php?id=8.

Profile
 
 
Posted: 04 April 2006 02:02 PM   [ Ignore ]   [ # 11 ]
Newbie
Rank
Total Posts:  17
Joined  2006-03-09

thanks, wil give it a look, but i think you misunderstud me, resolution does not concerne me, was talking about your .js
what i was after is something like ones in 1st couple of posts, simple style swith that would alter style sheet when user chooses so.
..and you said it can be done with php only, but you are using js on your site, thats where my confusion started, lol.
thank you.
?see, in 1st post:

...and would like to offer users the option of clicking a link to alter the stylesheet…

so no, cookies or resoultions isnt important here

Profile
 
 
Posted: 26 May 2006 01:41 AM   [ Ignore ]   [ # 12 ]
Newbie
Rank
Total Posts:  7
Joined  2006-05-20

There is another tip for css style change.
http://66.102.7.104/search?q=cache:71vyhpDvnLgJ:www.codelifter.com/main/javascript/changestyles.html+stylesheet+change+java&hl=ja&gl=jp&ct=clnk&cd=9

Anyway, although I use stylesheet.js, sometimes there is a problem , which can’t load default css at Firefox.  Firedox loads dot.css at first. Does anyone know to fix it?
http://duck-river.x0.com/duckriver/home.html

<link rel=“stylesheet” type=“text/css” href=“black.css” media=“screen, projection” />
<link rel=“alternate stylesheet” type=“text/css” href=“blue.css” title=“blue” media=“screen, projection” />
<link rel=“alternate stylesheet” type=“text/css” href=“dot.css” title=“stripe” media=“screen, projection” />
<link rel=“alternate stylesheet” type=“text/css” href=“black.css” title=“black”  media=“screen, projection” />

Profile
 
 
Posted: 05 October 2007 01:36 PM   [ Ignore ]   [ # 13 ]
Newbie
Rank
Total Posts:  12
Joined  2007-09-28

hey dude there are samples on dynamicdrive or dyn-web.com just check em out.. theyre all there.. or google it!!
————————————————————————————————————————————————————————
multimedia everything!!

Profile
 
 
Posted: 21 October 2007 03:38 AM   [ Ignore ]   [ # 14 ]
Newbie
Rank
Total Posts:  21
Joined  2007-10-15

alistapart has a good discussion:h tp://www.alistapart.com/stories/alternate/

and a php discussion:http://www.mcu.org.uk/articles/styleswitcher.php

-chris olberding

Profile