2 replies [Last post]
Alanna
Offline
newbie
Last seen: 17 years 18 weeks ago
Joined: 2004-09-26
Posts: 1
Points: 0

Hello:

I am fairly new to CSS and need to know how to write the code that allows a visually impaired user to pick the font size that they need to view the page. I have seen sites like WiredNews which present different sizes of the letter "A" for example. The user can click on the size that they want and immediately the size of the font on that page will be changed.

Any help will be greatly appreciated

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 3 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Allowing user to select font size for webpage

They are using a javascript style sheet switcher, probably the one from the link bellow this works on the principle of writing different versions of your stylesheets in this case with different font sizing declared you then link to them in the head as usual but you call them "alternate" and give them a title which causes them to load only when selected the javascript allows the selection and loading of these sheets this is a device for IE as browsers such as Firefox allow for user selection of alternate sheets and text resizing unlike IE although if you specify font sizes in ems you can resize in IE as it's only px sizing that IE refuses to change.
This link is a detailed explanation on how to use the styleswitcher, you can gloss over the javascript detail, the link for the file is towards the bottom.
http://www.alistapart.com/articles/alternate/

Let us know how you get on,

Hugo.

P.S the link to the code is a text page you will need to cut and paste it into notepad and call it something like "styleswitcher.js" and link to it in the head of your page.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

capmexbiz
Offline
Regular
Last seen: 17 years 17 weeks ago
Joined: 2004-09-29
Posts: 14
Points: 0

Allowing user to select font size for webpage

I prefer to use relative units "em" and "ex" or percentage values "%" instead of "px" for text values. That way a user who needs these aid will be able to change text size as much as he wants.

It's more probable that they have their browsers configured to present a larger font.

Webmaster Resources for Business Websites