Forum Moderators: open

Message Too Old, No Replies

Quick FontSize Question

         

vipergts

10:47 am on Jul 24, 2003 (gmt 0)



hi, im trying to make a script that detects users browsers and uses different font sizes.

here is the script

<script>
if (navigator.userAgent.indexOf("MSIE")!= -1)
{
document.body.style.font="30px";
}
else
{
document.body.style.font="50px";
}
</script>

but it does not work... and i dont want to use external css files. so can anyone help me? thanks!

tedster

12:56 am on Jul 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried this --

document.body.style.fontSize="30px";

I was doing some research in this area, by the way, and stumbled on this tidbit.

As of Internet Explorer 6, when you use the!DOCTYPE declaration to specify standards-compliant mode, the default value for this property [fontSize] is small, not medium.

Negative values are not allowed. Font sizes using the proportional "em" measure are based on the font size of the parent object.

Microsoft Font Size reference for IE6 [msdn.microsoft.com]