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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wrapping text without spaces?

Status
Not open for further replies.

topher0303

Programmer
Jan 5, 2003
186
US
How do you get text to wrap that has no spaces? The following html will wrap because it has spaces:

<table style=&quot;table-layout: fixed;&quot;>
<col style=&quot;width: 50px; vertical-align: top;&quot;>
<tr>
<td>1, 2, 3, 4, 5, 6, 7, 8 , 9, 10</td>
</tr>
</table>

However, remove the spaces as follows and it will not wrap.

<table style=&quot;table-layout: fixed;&quot;>
<col style=&quot;width: 50px; vertical-align: top;&quot;>
<tr>
<td>1,2,3,4,5,6,7,8,9,10</td>
</tr>
</table>

Is there a way to force it to wrap even without spaces?

Chris.
 
The obvious answer is insert a <br>.

If you are dynamically creating the text (asp/php) then you may need to look at the string before you write it.... Get the Best Answers! faq333-2924
&quot;A witty saying proves nothing.&quot; - Voltaire
mikewolf@tst-us.com
 
The text is user input. There would be now way to determine where to put the <br>. I was thinking about going through the text and adding a space after each comma. However, if the user uses something other than a comma, I would have to search for who knows how many different punctuation characters.

I was just curious if there was a style or something that would cause it to wrap. That is much easier than trying to parse and interpret user input. Most windows apps will wrap in this manner that accept user input.

Chris.
 
Is the user allowed unlimited length? Is it an input box or a textarea? In a textarea...

<textarea name=&quot;test&quot; wrap=hard></textarea>

&quot;hard&quot; will transmit line endings to the server.... Get the Best Answers! faq333-2924
&quot;A witty saying proves nothing.&quot; - Voltaire
mikewolf@tst-us.com
 
The information is input from a textarea and stored in the database. However, the input is not the issue. It is displaying it on the page at a later time. The html I put in the original post is the result that my ASP page produces.

The first example displays the information in the table cell that looks something like this:

1, 2, 3,
4, 5, 6,
7, 8, 9,
10

It wraps within the cell. Take the spaces out and it looks like this:

1,2,3,4,

It does not wrap, it is clipped. I was asking if the there is a style that would cause the second example to wrap.

Thanks,
Chris.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top