Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

force rowbreak/wrap in table

Status
Not open for further replies.

801119

Programmer
Apr 10, 2000
311
SE
greetings alls..

How do I enforce rowbreak/wrap in a table?

Cause if someone posts a hundreds "A"'s in my guestbook it kind of craps up my design :/

Is there anyway of forcing rowbreak/wrap when the TD has been filled?

My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
I don't think you can, but maybe you can break up long lines like that on the server, after someone submits it from the guestbook.

 
One option would be to put the content in a DIV with an overflow value set to scroll like this:

<div style=&quot;overflow-x:scroll;width:200px&quot;>
Woah... that word is way too long. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</div>

then the worst that will happen is you'll have some scroll bars, it won't throw off your layout.

I hope that helps.

A javascript method would be to split the string by a space character and then check the length of each word... if a word is too long... split it at the limit. Or just take it out. I mean, what kind of freak (errr. user) entered a word like that anyway.



Travis Hawkins
BeachBum Software
travis@cfm2asp.com
 
The following will work in IE only:

Code:
<html>
<head></head> 
<body>

<table width=&quot;200&quot; border=&quot;1&quot;>
<tr>
	<td>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td>
</tr>
</table>

<table width=&quot;200&quot; border=&quot;1&quot;>
<tr>
	<td style=&quot;width:200px;word-wrap:break-word;&quot;>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td>
</tr>
</table>

</body>
</html>

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top