Previous Message
Next Message

px2em Conversion

Sent by Tonico Strasser on 30 November 2003 14:02


Antonio wrote:
> Le 30 nov. 03, à 01:23, Tonico Strasser a écrit :
> 
>> I was curious how much ems is 12px. In most browsers the default 
>> font-size is 16px. (Please correct me if this is wrong.)
[...]
> 
> Hi Tonico,
> 
> I think your demo is correct, except that you should perhaps delete :
> 
> html>body {
>   font-size: 16px;
> }
> ...in your style sheet in order  to verify your hypothesis in a browser, 
> changing the default font size...  ;-)

Hello Antonio,

thanks for your reply. So I correct this to: IE/Win defaults its 
font-size to 16px. Other browsers (and hopefully all future browsers) 
can zoom fonts in any unit.

If you want a 12px font that can be resized by IE/Win the solution might be:

body {
  font-size: 75%; /* IE defaults to 16px, 75% = 12px */
}
html>body {
  font-size: 12px; /* for browsers with text-zoom */
}

or even shorter whith the underscore hack:

body {
   font-size: 12px;
   _font-size: 75%;
}

12 / 16 = 0.75

px / font-size = em

The demo shows how to convert px to em, it is not affected by this 
workaround.

Tonico

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Possibly related: