Forum Moderators: not2easy

Message Too Old, No Replies

Having Text Size Change in Browsers When CSS is Used Like With HTML

         

gouri

12:10 am on Jan 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In HTML, when you use size="2" as your font size and when you change the text size in your browser, the text specified as size="2" will adjust accordingly.

In CSS, when you use pixels or points, the text size will not adjust when the text size in the browser is changed.

I have a few pages where I use HTML to specify font size and I am also using CSS to specify font size on the same page so when I change text size in a browser some of the text is changing and some is not.

Is there anything I can do in my coding of font size in CSS so the size of the text specified with CSS also adjusts? I need help with inline CSS. I am working with Trebuchet MS size="2".

This would really help me.

simonuk

8:29 am on Jan 29, 2009 (gmt 0)

10+ Year Member



Thankfully you cannot control the font in all modern browsers :-)

The best course of action for you is to use em's or percentages.

Personally I set the font-size in the body as a percentage (62.5% in case you're wondering) and then use em's everywhere else. At the above percentage 1.2em equals 12px and so on.

swa66

9:08 am on Jan 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



relative sizing, usign em, ex, % etc allows the browser defaults to rule.

I'm myself not a fan of the 62.5% font sizing.

Browsers can have user specified settings overruling your fonts and/or specify a minimal font size to be used.

Modern browsers (like e.g. FF3) allow the user to zoom in and out way beyond your control, which is a good thing.

Remember that font sizes that you force to be small are potentially an accessibility problem for those in need of a larger font.

gouri

1:25 pm on Jan 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I first wanted to say thank you. I am just not very familiar with this and I would appreciate if you could please help me with this a little more.

In HTML, when using size 2 in trebuchet ms it is equal to 10pt or 17px. When I use trebuchet ms in css on the same page (because I have to use CSS and also HTML on a couple of pages) what percentage should I set the font size to so when I change the text size in a browser (IE, Mozilla) the text defined by CSS looks the same size as the HTML defined text?

How do you figure this out? It is a little frustrating.