Click to See Complete Forum and Search --> : Specifying height of a table row?


tobyw_1969
05-21-2003, 11:24 AM
Is there a limit to how small you can make the height of a table row?

I want to use small GIF's in a table, to make writing appear in a nice rounded background box. To do this, I am using the GIF's in the top and sides as background images - that means they can re-scale automatically to the size of the table, and the effect will be preserved whatever someone's text settings etc..

BUT - although I specify the hieght of the row, it doesn't have any effect. The row is still default size, and the image therefore tiles vertically.

Box in table (http://www.netcartoon.net/box.html)

I have specified the height in all the cells on the bottom row, and there is no text in them. I have even tried settingthe font size to the smallest possible anyway, just in case that helps. But it stays the default size.

I am sure this can be done, cos websites like Amazon use have things like this. I really want to stick with the top, side and bottom images being cell backgrounds because it means the table can still be relatively scaled.

Anyone know why this happens?

Thanks

gil davis
05-21-2003, 11:34 AM
This cell:
<td background="images/boxo_12.gif" height="13" valign="top">&amp;nbsp;</td>sets the height to the default text size and conflicts with the specified cell height. Therefore, the browser ignores the requested height in favor of the text height.

pyro
05-21-2003, 11:39 AM
You could use CSS to set a new font-size so the cell will be the size you specified like this:

<td background="images/boxo_12.gif" height="13" valign="top" style="font-size:1px;">&amp;nbsp;</td>

tobyw_1969
05-21-2003, 01:01 PM
Thanks gil / pyro. Sorry to be stupid, but where in that tag is it specifying default text size? Or do you just mean because it DOESN'T specify a text size, the browser assumes it?

In theory, couldn't I just specify the text size instead of using CSS? I will try both anyway.

Thanks as ever for the help.


PS. Otherwise, is this an ok thing to do? I know people get funny about background images, but it seems a logical way to create the effect. Will there be any risks?

gil davis
05-21-2003, 01:32 PM
Originally posted by tobyw_1969
do you just mean because it DOESN'T specify a text size, the browser assumes it?Yes.
In theory, couldn't I just specify the text size instead of using CSS?Yes.
is this an ok thing to do?If you had used a plain image instead of using the bgImage property of a table, you would not have had to ask for help with the cell height, because the &amp;nbsp; would not have been necessary. To each his own. I do not try to judge, only help when problems arise.

tobyw_1969
05-21-2003, 06:56 PM
yes I know - but the whole point of using the bg-image is so you can use a tiny GIF and stretch it automatically to the size of the table - even when someone has a larger text size. is there a way to make a plaing <img> tag automatically stretch?

gil davis
05-21-2003, 08:24 PM
This works in IE:<tr height=13>
<td><img src="whatever" height="100%" width="100%"></td>
</tr>I should point out that there is an ongoing arguement against "misusing" the table element for page layout, and that this trick does not work in NS 4 or NS 6.

tobyw_1969
05-22-2003, 06:57 AM
Thanks a lot gil. Clear and useful replies :)

I think I will stick to the background thing, because at least it seems to work in NS.