The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS em: how do you start? Re: em: how do you start?


“begetolo” said:
In my opinion it would make more sense to set the fontsize in body tag to font: 10px. This would give more reliable results. If, for some reason, IE, firefox, chrome or whatever browser is changing there default fontsize and you use the percentage trick, it would mess up your site. Sticking to for example to font:10px you don’t depend on the browser’s settings.
I don’t know of any drawbacks to this method, but there must be a reason why many developers use the percentage trick in stead of the ‘hardcoded’ 10px method. Maybe one of you can tell me why. I hope so….

I believe this is because if you start with a pixel based size and then adjust using ems, IE6 and 7 will see the px based size and refuse to resize the text. Defeats the purpose of using ems in the first place.

Then how about setting the body{ font-size: 10pt} and then use 1.1, 1.2, 1.3, 1.5em, etc for all other text… Use pt, instead of px and have more control over the pages… The only down-side I see to this approach is that we’d be overriding any default fonts the user specifies. I wonder what the stats are on users specifying their own font sizes?…