Jump to content

set CSS based on user info


arne

Recommended Posts

I want to set different CSS, based on a user's screen width (eg one stylesheet for 800px width, one for 1024px width, and so on). I do NOt want the user to choose, this should be done automatically when loading the page. How to? Can't seem to find an answer on the net, only for form triggered stylesheet switchers and that is not what I am looking for.Maybe this should be in JavaScript forum?

Link to comment
Share on other sites

Use javascript to dertermine the screen dimenstions then based on the values display the appropriate stylesheet.I think i have this lying around somewhere, i'll try dig it out later on. :)

Link to comment
Share on other sites

Use javascript to dertermine the screen dimenstions then based on the values display the appropriate stylesheet.
Yes, I came to that conclusion, too.
I think i have this lying around somewhere, i'll try dig it out later on.  :)
That'd be great! I tried to do it myself but my JavaScript knowledge is close to 0 and too busy to dive into it... much appreciated!
Link to comment
Share on other sites

Ok here it is, i won't bore you with how it works :) All you need to know is that there are 3 stylesheets, low, medium and high, each one obviously relates to that resolution. Change these anyway you like.Preview and download the files from here.http://scott100.atspace.com/switcher.htmIf for some reason the browser has javascript disabled it will default to the low.css stylesheet.Any questions give me a shout :)plus it works in IE, FF and Opera :)

Link to comment
Share on other sites

Ok here it is, i won't bore you with how it works :)  All you need to know is that there are 3 stylesheets, low, medium and high, each one obviously relates to that resolution.  Change these anyway you like.Preview and download the files from here.http://scott100.atspace.com/switcher.htmIf for some reason the browser has javascript disabled it will default to the low.css stylesheet.Any questions give me a shout  :)plus it works in IE, FF and Opera  :)

you are the best! thank you so much!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...