Jump to content

several styles per page


real_illusions

Recommended Posts

i've had a look round the internet, and it seems to be the only way to create a way for users to select different stylesheets for a page is to use javascript.Is there a different way of going about this? especially as i only need to alter the size of the text, as the site i'm making is mainly based at people with difficulties with seeing.thanks:)

Link to comment
Share on other sites

I'm not 100% sure what you mean but if you mean switching between different stylesheet by clicking a link then yes you would use javascript to switch between them. If you mean simply changing the size of your text then all you need to do is add this in your head section:

<style type="text/css">body { font-size: 11px; }</style>

Link to comment
Share on other sites

You can also use a server side scripting language but that will force the page to reload.

Link to comment
Share on other sites

to expand a little on what has been said, you only have two options - client side or server side solutions. Javasccript is the only client side approach so typically you will see "A- A+" in a corner of a site (with the first "A" being slightly smaller than the second). These call a javascript that will swap the stylesheet out. The problem is that only holds true for that page unless you take it farther, and incorporate a cookie to remember the setting.The alternative is to use server side scripting, as boen_robot points out. Here, however, you have two options. One, use the same "A- A+" technique to load a default setting and allow users to manually increase the size. Again, it would be advised to take it a step farther and have selection stored in the cookie or session scope. Secondly, you could use software (if available to you) called BrowserHawk which will sniff the users default font settings. Most impaired people will have these adjusted for their needs. Once you have sniffed this out, you can automatically load the most appropriate stylesheet based on some conditions you define.Obviously, the latter takes much more effort and has technology requirements. The advantage is that is doesn't require user interaction as it automatically adjusts itself (how friendly is that). With the other (manual) methods you have short lived convenience but a much easier application to program. Of course, if in any situation you require a user to log in, then you should have their default set in their preferences so it is also automatic when they log in. I've even stored their default as a cookie and programmed the not logged in site to look for that cookie before applying the default. This way if I'm not logged in and using the same computer, I do not have to "A-" or "A+" a page since my logged in preference was set to a cookie the last time I logged in.Hope this helps.

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...