RoyalEnfy
RoyalEnfy

Reputation: 127

How to get table data content to next line?

I have a table of width 100% (fit to screen ) with 3 <td> in that. In 2nd <td> I have some content like this addfdss212s1ssff54f5df4d54s54dsf64dsfsadjvmckjsadkjkdflsadfkksdalasdflsdfkasd6f465, this content does not contain any space. I have given 70% of width to the 2nd <td> but when the characters of content increases that 2nd <td> expand and layout get disturb. Is it possible to get increased character to next line in width of 70% with the help of CSS? (see below in the code).

<table width=”100%”>

<tr>

<td width=”10%”>Result1</td>

<td width=”70%”>addfdss212s1ssff54f5df4d54s54dsf64dsfsaDjvmckjs adkjkdflsadfkksdalasdflsdfkasd6f465 </td>

<td width=”20%”>Comments</td>

</tr>

</table>

Upvotes: 3

Views: 8448

Answers (2)

Greg
Greg

Reputation: 8784

Try:

<table style="table-layout: fixed">
<tr><td style="word-wrap:break-word">LongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongWord</td></tr>

From: https://stackoverflow.com/a/1883702/585552

Upvotes: 6

Jeff
Jeff

Reputation: 12785

I think the rule you're probably looking for is:

word-wrap: break-word;

Upvotes: 3

Related Questions