Click here to get back home

How to display a box in "em" units?

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How to display a box in "em" units? axlq 04-01-2006
Get Chitika Premium
Posted by axlq on April 1, 2006, 12:54 pm
Please log in for more thread options


I'm trying to figure out how to display a box that has a width in
"em" units. So far no luck. Below is some HTML that displays two
rows of 30 'm' characters in lowercase and uppercase, followed by
a 30em-wide table and a 30em-wide div block. I'm using HTML 4.01
Transitional doctype.

================================
<p>lines of 30 M:<br>
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<br>
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm<br>
<table width="30em" border=1 cellspacing=0 cellpadding=0>
<tr><td>30em wide table</td></tr>
</table>
<div style="border: 1px solid black; width=30em; min-width=30em; float: left;">
30em wide rectangle
</div>
================================

The resulting table appears to be 30 pixels instead of 30em. It's
very narrow.

The div block is only as wide as the containing text. It's
certainly not 30 M characters wide.

What am I doing wrong? The example above works the same in IE and
Opera.

Also, which M width is used by the "em" units? Uppercase or
lowercase? These widths are different for larger font sizes.

-A

Posted by Chris Morris on April 1, 2006, 1:18 pm
Please log in for more thread options


axlq@spamcop.net (axlq) writes:
> I'm using HTML 4.01 Transitional doctype.

Why not strict?

> <table width="30em" border=1 cellspacing=0 cellpadding=0>

<table style="width: 30em" border=1 ...

> Also, which M width is used by the "em" units? Uppercase or
> lowercase? These widths are different for larger font sizes.

Neither - it's the width of the "em quad".

--
Chris

Posted by axlq on April 1, 2006, 1:56 pm
Please log in for more thread options


>axlq@spamcop.net (axlq) writes:
>> I'm using HTML 4.01 Transitional doctype.
>
>Why not strict?

Does it matter? Does the behavior of "em" units change between
transitional and strict?

-A

Posted by Jim Moe on April 1, 2006, 8:02 pm
Please log in for more thread options


axlq wrote:
>>> I'm using HTML 4.01 Transitional doctype.
>>
>>Why not strict?
>
> Does it matter? Does the behavior of "em" units change between
> transitional and strict?
>
Yes.
No.

Transitional, as you might surmise from the term, was meant to allow a
gradual transition from pre-v4 HTML to v4. Implied in the name is
transition, temporary, for a little while, short time, placeholder, a
breather space. It was never intended for common, ongoing usage.
A more cogent reason for Strict is that browser rendering is more
uniform and predictable, especially IE.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)

Posted by Eric B. Bednarz on April 1, 2006, 9:02 pm
Please log in for more thread options



> A more cogent reason for Strict is that browser rendering is more
> uniform and predictable, especially IE.

Pardon, 'especially IE'?

I suppose you actually mean doctype sniffing by 'strict'.

* IE < 6 doesn't do doctpe sniffing. Double your efforts.
* IE 6 in 'standards-compliant mode' does have lots of bugs that IE 6 (and
lower) otherwise does not sport. Quadripple you efforts.
* Client side or any inbetween proxy software can unexpectedly -- and
legally -- wave good-bye to 'standards-compliant mode', and you'll
never know; say hello to voodoo-programming.
* The MSDN excuse for documentation clearly states that
'standards-compliant mode' is *not* predictable.


--
||| hexadecimal EBB
o-o decimal 3771
--oOo--( )--oOo-- octal 7273
205 goodbye binary 111010111011

Similar ThreadsPosted
Is this able to be done (add units to XML) April 3, 2005, 9:10 am
7-bar display October 30, 2006, 3:22 am
IE TextArea Display Bug January 12, 2005, 10:16 am
IE7 doesn't display background.. May 23, 2007, 10:55 pm
XML table display using CSS November 27, 2007, 11:05 pm
Display in in frames January 30, 2008, 12:55 pm
Can't get normal display. April 3, 2008, 6:37 pm
HTML Display Correctly, But Not Right August 2, 2004, 4:24 pm
How to let the tooltip display over input box near-by September 29, 2004, 8:02 pm
IE does not display/position June 14, 2005, 7:58 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap