S B
S B

Reputation: 1363

Dynamically change table height

I'm facing problem with table in html, actually I fixed the width,and want to increase the td height as per the content in it, for example : if td width is 30px and when data inside td crosses the td width i want to show remaining data in next line and so on..

table:

<table width="100%" border="1" >
        <tr>
            <td align="left" width="30px">
                laaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa text
        </td>
            <td align="left" width="30px">
                text
        </td>
        </tr>
      </table>

Upvotes: 1

Views: 6878

Answers (1)

Sumit Gera
Sumit Gera

Reputation: 1241

Here is the solution to your problem! The width of the columns are equal in this case, though they can be changed, not to mention.

<table  border="1" width="100%" style="table-layout:fixed">
<tr>
<td style="word-wrap:break-word">Hellohellohellohellohellohellohellohellohellohellohello
<td>text</td>
</tr>
</table>

And here is the demo http://jsbin.com/ihaxob/2/edit .. I have seen the solution from this thread!

Word-wrap in an HTML table

Upvotes: 2

Related Questions