View Full Version : Font Sizes

May 11th, 2007, 02:33 PM
I am wanting users to change the font size. I have a Javascript script, but I had been told it would be better to use CSS.

Can anyone help me to achieve this please?

Thanks in advance, and if I need to change anything, can you tell me because I am totally new to this coding thing.

May 11th, 2007, 03:01 PM
Hi again colster :), question... have you linux or windows hosting?

May 11th, 2007, 05:26 PM
well, I havent got any hosting as of yet, because I cannot afford, but I will be getting Windows Hosting.

May 11th, 2007, 05:34 PM
question... have you linux or windows hosting?
What does that have to do with anything?

You can't use CSS to change stuff. You need to use JavaScript for that. HTML defines the page structure, CSS the design (ie colors, widths, backgrounds etc) and Javascript the behavior (any actions the site performs).


May 11th, 2007, 05:43 PM
Ok, never mind.. But, I suggest you rather linux hosting, there will be running PHP and I think PHP is better / easier to learn .. And now about the font size.. do you use any CSS in your HTML? I mean.. external with something like this

<link rel="stylesheet" type="text/css" href="main.css">

or embedded something like this...
body {
font-size: ....;

If you are using embedded, save it as css file and define the external definiton rather.. then name the css file after the font size what you want.. for example in

you have:
body {

you have:
body {

you have:
body {

And then just link from all your sites to target definition file for example

<link rel="stylesheet" type="text/css" href="small.css"> or
<link rel="stylesheet" type="text/css" href="medium.css">

And that value small/medium/large will be read dynamically from cookie like this...

<?php if ($_COOKIE['fontsize']=='small') || ($_COOKIE['fontsize']=='medium') || ($_COOKIE['fontsize']=='large')
echo '<link rel="stylesheet" type="text/css" href="'.$_COOKIE['fontsize']'.css">';
else echo '<link rel="stylesheet" type="text/css" href="medium.css">';

And the last step is store the value in the cookie, you can do it from javascript or from PHP that's better.. I can help you with that later if you want, when you will be running your hosting...

May 11th, 2007, 06:29 PM
right, okay.. thanks for your help. When i get hosting, which should be around July/August, I will come back for help.

Thanks for all that came and helped me. Much apreciated.

May 11th, 2007, 07:29 PM
Here's a good article on dynamically resizing fonts: http://alistapart.com/articles/fontresizing