Page 1 of 1

TD WIDTH

Posted: Tue Jul 13, 2004 5:10 am
by mjseaden
Dear All,

I'm trying to get my TD elements to stick at a certain width - however because the TD is sometimes populated with text that is longer in pixel length than the stated WIDTH of the TD, the TD automatically resizes to fit the text. I don't want it to do this - rather I would like the text to be 'wrapped' around the size of the cell whilst the cell is kept at the stated width.

Is there any way of doing this?

Many thanks

Mark

Posted: Tue Jul 13, 2004 5:15 am
by kettle_drum
You can either use php to check the string length and then cut the string up into new lines or you can use the overflow: scroll in CSS.

Posted: Tue Jul 13, 2004 5:15 am
by patrikG
TD is HTML. HTML is Client-Side.

Post moved to Client-Side forum.

Posted: Tue Jul 13, 2004 10:34 am
by johnperkins21
Do you have an example of code that isn't working? This should work:

Code: Select all

<table width="200">
<tr>
<td width="100">A whole buttload of text... blah, blah</td>
<td width="100">A whole buttload more text... blah, blah</td>
</tr>
</table>
If you have one really really long string, like trying to put posting.php?mode=reply&t=23778 into a TD tthat isn't big enough for it, it may try to resize your TD on you. If all else fails try:

Code: Select all

<table width="200">
<tr>
<td width="100" style="word-wrap: break-word;">A whole buttload of text... blah, blah</td>
<td width="100" style="word-wrap: break-word;">A whole buttload more text... blah, blah</td>
</tr>
</table>

Posted: Tue Jul 13, 2004 10:38 am
by malcolmboston
patrikG wrote:TD is HTML. HTML is Client-Side.

Post moved to Client-Side forum.
gotta admire the simplicity of that post. :wink:

Posted: Tue Jul 13, 2004 10:56 am
by patrikG
malcolmboston wrote:gotta admire the simplicity of that post. :wink:
/cackle :lol:

Posted: Tue Jul 13, 2004 11:17 am
by d3ad1ysp0rk
johnperkins21 wrote:Do you have an example of code that isn't working? This should work:
He might mean something like:
thisisanextremelylongwordthattakesupmorethanthetdwidth

Posted: Tue Jul 13, 2004 12:45 pm
by magicrobotmonkey
If you have one really really long string, like trying to put posting.php?mode=reply&t=23778
I think thats what he meant with this.

Posted: Tue Jul 13, 2004 12:56 pm
by johnperkins21
Ok, I just tested that whole style="word-wrap: break-word;" nonsense. It works in IE 6, but not in Firefox. Your next option is to use PHP, unless someone else knows of anything.

Try here: http://us4.php.net/wordwrap