The recent discussion of ems vs pixels got me thinking about the site
tweak I was exploring recently, when I inquired about the validity of
display: table-cell. I still haven't implemented the changes I was
looking at; I'm still in exploratory mode, and - as usual - have too
much hands on my time. (The person who figures out how to apply
Microsoft's "DriveSpace" to real life will make a fortune!)

I'd like to confirm my understanding of how sizes in ems are applied to
various elements:

If I set a width on an element - or a max-width or min-width - in ems,
is it correct to assume that the "actual" size will be based on the font
size OF THE PARENT ELEMENT? In other words, if the font size in the BODY
is 12-point, and I set the width of a DIV to 10em, it will be 120 points
- or, at 16px=1em (same as 12 point, at 96ppi), 160px - correct? And
then, the text inside that div will default to the same 12pt=16px=1em
unless I reset it - and if I reset it to e.g., 0.75em, and then there is
a SPAN inside a P in that DIV, the 'default' em size for the SPAN will
be 9pt=12px="1em", unless I reset THAT:

(In the below, I'm using curly brackets instead of angle brackets to
keep HTML-based mail programs from "accidentally" trying to render it.)

{!DOCTYPE HTML}
{HTML style="font-size: 12pt;"}
  {BODY}                              {!-- 1 em is (still) 12 points --}
    {DIV style="width: 10em;"}         {!-- width will be 120 points --}
      {P}This text's em size is 12 points.{/P}
      {P style="font-size: 0.75em;"}This P's em size is effectively 9
       points, and {SPAN style="font-size: 0.67em"}this SPAN's em size
       is effectively 6 points,{/SPAN} and this is back to 9 points.{/P}
      {P}And this is back to 12 points.{/P}
    {/DIV}
  {/BODY}
{/HTML}

HOWEVER, if I use *rem* instead of *em* in the sample above, the BODY
will still have an em size of 12 points, the DIV will still be 120
points wide, the first and third P will still be 12 points, the second P
will still be 9 points, but the SPAN inside the second P will be EIGHT
(8) points instead of SIX (6), correct?


Now, assuming that my understanding is correct... Are the character
entities emsp (em space) and mdash (em dash) truly and reliably one em
in width? Or does the lousiness of many (free) fonts out there extend
even to this?

-- 
Jeff Zeitlin, Editor
Freelance Traveller
    The Electronic Fan-Supported
    Traveller® Fanzine and Resource

edi...@freelancetraveller.com
http://www.freelancetraveller.com
http://freelancetraveller.downport.com/



®Traveller is a registered trademark of
Far Future Enterprises, 1977-2014. Use of
the trademark in this notice and in the
referenced materials is not intended to
infringe or devalue the trademark.

Freelance Traveller extends its thanks to the following
enterprises for hosting services:

CyberNET Web Hosting (http://www.cyberwebhosting.net)
The Traveller Downport (http://www.downport.com)
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to