[vox-tech] Fwd: css: cell width and height

Mark K. Kim lugod3MAPS at cbreak.org
Sat Dec 16 13:29:42 PST 2006


On Sat, Dec 16, 2006 at 12:27:25PM -0800, Joshua Morris wrote:
[snipped: question about creating HTML table cell with specific size]
>    I would give the td sections an id to separate them from the other td tags
>    such as
> 
>    <table>
>         <td>foo</td>
>         <td id="special">bar</td>
> 
>    then in you css you would have
>    table {height: 1px; width: 2px;}
>    #special {height: 3em; width: 2em;}

In addition to setting the height and width of the <td> tag, I think
there's also the issues of margins, borders, and padding, all of which
contribute to the cell "size", depending on what one means by "size".

The definition of "size" is also in question.  Do you want to set the
cell's size to be 3emx2em *with* the border or *without*?  Does 3emx2em
include or exclude the margin around the cell?  What about the padding
inside the cell?  Unfortunately the answers to these questions depend
from browser to browser and version to version, in big part because of
IE's incorrect implementation of the CSS standard in its old
implementation.  The newer versions of IE handle it properly if you set
the doctype of the HTML document to XHTML 1.0 or newer, as I recall.

Also, there is also the issue of how the cell should handle cases when
the object inside the cell is too big to be fit in the specified cell
size.  What happens if the object inside the cell is 5emx5em?  Should
the cell expand automatically?  Clip it?  Let the object extend outside
the cell but keep the cell size the same, making the object look like
it's just overlaying on top of the cell?  You can control this setting,
too, using the "overflow" parameter.  How well this parameter is
supported, too, depends on the browser, apparently because it's sort of
hard to implement properly, and as I recall some browsers still don't
implement them properly even in their latest version.

-Mark



More information about the vox-tech mailing list