Previous Message
Next Message

px2em Conversion

Sent by Tonico Strasser on 30 November 2003 18:06


Hello Christoph!

Christoph Päper wrote:
> @import "advocacy/font-size#px";
> @import "advocacy/font-size#%3C1em";

Is that an import hack?

> You cannot reliably convert a relative unit into an absolute, because you
> don't know all parameteres the relative one is influenced by. This is even
> more true when inheritance comes into play.

Yes, except if you know how much px is the font-size of the parent element.

> "Most" is disputable, but in some, yes. Some give it in points instead (e.g.
> 12pt), which may or may not compute to 16px on a certain screen.

You are right. Many things in design are compromises. If you set the 
font-size on the body element to 75%, you don't know how much px that 
will be.

If you assume a base font of 16px, what will happen if the base font 
renders to 12px or 20px?

assumed = 16px   default = 12px   default = 20px
20px = 1.25em    = 15px           = 25px
16px = 1em       = 12px           = 20px
14px = 0.88em    = 11px           = 18px
12px = 0.75em    = 9px            = 15px
11px = 0.69em    = 8px            = 14px
10px = 0.63em    = 8px            = 13px

What I want to say, I can live with that. If all browsers could zoom 
font-sizes I wouldn't have that differences, because I would set the 
body to my desired font-size, and calculate childrens font-size based on 
that value.

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

Message thread:

Possibly related: