Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preferred Font Size Type - %, px, em

Status
Not open for further replies.

superslurpee

Programmer
May 15, 2002
108
Hey,

I have been using percentages for CSS font sizes for years but was wondering what everyone else uses. I notice that px is becoming more popular and it resizes in the browser when the user wants it to. Some years ago it was only percentages and em's that did that and that's why I went with '%'.

So is it time to start using px for font sizes or is there an advantage to percentages? I'm not a huge fan of em's even though it's similar to percentage. I actually find px the easiest to comprehend so I thought I would get your opinions.

 
Hi

Our opinion ? Then here is mine. I just hope this will not end as flame.

Personally I almost exclusively use absolute size.

Otherwise I am convinced that the font size's unit of measurement is [tt]pt[/tt] ( point ), as that is used in most text processing applications.

Feherke.
 
I use em's exclusively. Pixels (px) are still not resized in IE AFAIK, at least as of version 7. Same would go for points (pt). I could use % the same way I use em, but I am simply more used to the latter.

[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
I use EM , as I understood it, it is the correct scaling to use to enable users to change font sizes as desired.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Like feherke, I typically use absolute size and percentages.
See Dan Cederholm's Bulletproof Web Design among many other references.

Code:
body {
...
	font-family: Verdana, sans-serif;
	font-size: small;
	}
#content {
	font-size: 95%;
	line-height: 1.5em;
...
	}

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
I use em's becasue I use em's for other things than just font size:

Code:
#nav a {
	display: block;
	width: 6em;
	color: black;
	font-family: Georgia, san-serif;
	font-weight: 900;
	font-size: .9 em;}

I use Son of Suckerfish and it uses em's.



 
Strictly speaking an em is a size relative to the M character of a given font.

So really, you should specify a size for your base font too. This can be in pixels or pts I guess.

There's nothing really wrong with relying on the browser base size though.

Modern browsers, including IE7, are starting to zoom the page rather than scale the text. This makes life much easier as the layout scales as a complete page.

That said, I tend to use ems but sometimes use percentages depending on the mood I'm in. :)

Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Good point Foamcow. I did notice that IE7 and Firefox zoom the page instead of scaling the text, so that's why I wondered if the whole 'resizable vs. absolute' font sizes was still a big issue. I have always been an advocate for allowing the user to resize the font because there was a time when you could only do that when the font was em's and percentages but the font would grow outside the layout which looked really stupid and sometimes made it harder to read. I used to use em's but just hated doing '.5em' or '1.6em' with the decimal. Percentages just made more sense to me.

However since IE7 and FF browsers zoom the entire page (thus zooming px and pt font sizes as well), what is the advantage to using percentages or em's anymore? px and pt may not actually resize, but the zoom feature sure does the trick.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top