Is there a way to override the browser font size settings with javascript. Basically we want to set the text size on a page so that if someone has their browser font setting say to "large" it does not take effect.
| SitePoint Sponsor |
Is there a way to override the browser font size settings with javascript. Basically we want to set the text size on a page so that if someone has their browser font setting say to "large" it does not take effect.

You dont need javascript to accomplish this, just use absolute sizes for your text. Instead of "font-size: 1" use "font-size 8pt" or "font-size 8px"
Thank you for your response. Dictating a point size is only good in Netscape is it not?? I have found a solution not by using javascript but by using a CSS and it is working just as we wanted.





No, with CSS, all of the major browsers have supported it for a few years.Originally posted by kellyg
Dictating a point size is only good in Netscape is it not?
Note: Why would you want to go against your visitors' wishes? It doesn't make sense to make choices for them. I set my font size large for easier reading and when I go to these "next-generation" sites with 8pt type it really makes me mad. Just my $1. Keep the change![]()
because i have an image sliced to look like a story book and the images are in tables cells...to have bigger text, blows the table apart...thanks though

If you want real absolute sizes, you should go for pixels (px), not for points. Points are still relative to the browser settings.
</jppr>





You may want to search this form, this topic has come up before.
Basically, if someone sits a specfic font size in their browser or through the OS, you can not resize it with CSS or JavaScript. And there is good reason for this.
Most folks who intentionally reset their font sizes do so because of poor eyesight. If you try to override this (you can't) then your defeating the purpose because they won't be able to read your site anyway.

well you're wrong there westmich. Try going to any article on SP, click on "Print this article" and than change font size to biggest in View (in IE4 for example).
You'll see that nothing changes, except for the code.
Just by using pixels.
</thomas>





I stand corrected![]()

What exactly do you mean with "I stand corrected".
(My mother language != English)
Does it mean
"You're right, I was wrong"
or
"I keep with my point of view, you're wrong"
??
Thx
</jppr>




It means that he knows that he was wrong and that you were right![]()

Ok, thanks mkaufman.
So it is possible, but westmich has a point here:
So when you switch to absolute sizes, check on Macintosh computers (they see everything a bit smaller) how your site looks. If you can read it, and you have "average" eyes, you can suppose that others will see it too.Most folks who intentionally reset their font sizes do so because of poor eyesight. If you try to override this then your defeating the purpose because they won't be able to read your site anyway.
But, if your site is made for people of, let's say, 45 and older, don't use tiny font sizes. Adapt them.
For those of you that want an overview of how different browsers display fonts etc., visit
http://hotwired.lycos.com/webmonkey/...html?tw=design
Cheers





Correct! I offer my most humblest apologiesOriginally posted by mkaufman
It means that he knows that he was wrong and that you were right![]()
![]()
Bookmarks