...

View Full Version : How many ems in a px?



allida77
11-15-2002, 03:59 AM
I many ems are there say in a px or in? Does someone have a good link on measurements too?

Thanks

BrainJar
11-15-2002, 05:34 AM
Ems are an old printer's term. 1em is about the space taken up by the letter "M" in whatever font you happen to be using. So it will change based on the font family and font size in use.

Double the font size and you roughly double the width of the em. At least on Mozilla, if you have a DIV full of text with a width set in ems, the DIV will get widen when you increase the text size from the menu bar, giving a nice zoom effect.

I've found ems useful for text-heavy content. A width of 20em fits about 40 characters per line in most fonts, which gives means about 10 or 12 words per line. Change the font and the layout adjusts accordingly so you still get the same 10 or 12 words per line.

allida77
11-15-2002, 05:45 AM
Thanks for the info. I am trying to create a printable page that will look like a report when printed from a browser. Everything is set using css and alot of the refs for css I use, usually use ems instead of pxs.

BrainJar
11-16-2002, 06:53 PM
Did you know that you can specify style rules for certain media types?

/* default */
body {
background-color: #ffff00; /* yellow text on a black background */
color: #ffffff;
}

/* for printing */
@media print {

body {
background-color: #ffffff; /* black text on a white background */
color: #000000;
}
}

I've found this extremely useful for making pages print nicely without having to make separate pages just for prints.

These links might be helpful:

http://www.w3.org/TR/CSS21/media.html
http://www.w3.org/TR/CSS21/syndata.html#values

allida77
11-17-2002, 04:11 AM
That is excellent. It took me half the time it thought it would. Have you ever been able to get rid of the url and date on the bottom of the page when printing?

Paweł
11-17-2002, 07:11 PM
Hi !
Just open menu File|Page settings in your browser ( this is example from IE 5.5 ) and set empty field for footer.
or change key HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\PageSetup\footer in your registry.

Paweł.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum