Connecting Tech Pros Worldwide Help | Site Map

wrap text in a table

Familiar Sight
 
Join Date: Sep 2007
Posts: 207
#1: Sep 17 '07
Hello everyone
as you see below i have a table which contains some text. The text written in this table comes from a database which is sent by users.
My problem is that if some user writes a text without spaces longer than this table then the table will be stretched but i want the text to be wraped instead ( break )
-------------------------
<table width="100" >
<tr>
<td>
The text comes here...
</td>
</tr>
</table>
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,561
#2: Sep 17 '07

re: wrap text in a table


HTML cannot do this.
Newbie
 
Join Date: Sep 2007
Posts: 5
#3: Sep 18 '07

re: wrap text in a table


Quote:

Originally Posted by bnashenas1984

Hello everyone
as you see below i have a table which contains some text. The text written in this table comes from a database which is sent by users.
My problem is that if some user writes a text without spaces longer than this table then the table will be stretched but i want the text to be wraped instead ( break )
-------------------------
<table width="100" >
<tr>
<td>
The text comes here...
</td>
</tr>
</table>

Actually, try the style WORD-BREAK:BREAK-ALL. The breaking happens even if there is no delimiters in the text.

A little Google search revealed this nugget and it just may work.
Newbie
 
Join Date: Sep 2007
Posts: 3
#4: Sep 19 '07

re: wrap text in a table


Use the style WORD-BREAK:BREAK-ALL; the breaking happens even if there is no delimiters in the text
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,561
#5: Sep 20 '07

re: wrap text in a table


There is no such thing as "WORD-BREAK" in standard Html.
Newbie
 
Join Date: Sep 2007
Posts: 5
#6: Sep 20 '07

re: wrap text in a table


Quote:

Originally Posted by drhowarddrfine

There is no such thing as "WORD-BREAK" in standard Html.

Who's talking about HTML? This property is defined in CSS3. Therefore it's a style attribute, not an HTML tag.
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,561
#7: Sep 21 '07

re: wrap text in a table


Yes, I forgot about that. However, I'm not sure how well it is supported cross browser. CSS3 is still in the draft stage but this has been brought up here before. If someone wants to use this, I would search to make sure it is available in all browsers.
Reply