Click to See Complete Forum and Search --> : Suppress Table Width?


ecx00
06-15-2006, 02:51 PM
Hello,

Is there any way to suppress the width of a table cell regardless of what's in it, such as a large image?

Thanks.

felgall
06-15-2006, 03:08 PM
What exactly do you mean by "suppress the width". A table and everything in it have widths and heights because that is the nature of table elements since the purpose is to lay out the tabular data that they are to display. You can set the width and height on those elements the same way as for block elements on your page and then specify how the overflow is to be handled in order to determine whether it should expand to fit, add a scrollbar, or simply hide what wont fit.

ecx00
06-15-2006, 03:19 PM
Let me clarify.

I'm specifically dealing with long strings without breaking points, using the word-wrap function on the table cell. It does break the word to fit the size of the table. But not exactly so.

I have two tables below, both set to a width of 500. However, the one with the i's is a pixel or two wider than it should be.

<table border=1 bordercolor=0 cellspacing=0 cellpadding=0>
<tr><td width=500 style="word-wrap: break-word;">
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
</td></tr>
</table>

<table border=1 bordercolor=0 cellspacing=0 cellpadding=0>
<tr><td width=500 style="word-wrap: break-word;">
asdf
</td></tr>
</table>

(There shouldn't be any spaces in the i string above. The forum is adding those. So if you want to test it, please manually remove the spaces.)

It's obvious that the contents of the table cell is affecting its width even with the break-word.

My original question:

"Is there any way to suppress the width of a table cell regardless of what's in it?"

Thank you.

slaughters
06-15-2006, 04:23 PM
I think you need to use a DIV tag inside the TD to do this. Then just set the width of the DIV tag via a CSS assignment or an inline style to be the width you want it to be.