I have a table which display information from a database.
The problem is that if I display a long text inside <td></td>
then, it is displayed properly and the cell is expanded according to size but when the same text is displayed inside an input tag then, neither the cell nor the input is expanded to accommodate whole text.
I had tried setting width="100%"
it expands the text little bit but still i have to scroll along the text box to see rest of text .
Here is the Example
<table cellspacing="8" cellpadding="2" border="0" bgcolor="#00eeee">
.
.
<tr>
<td>HELLO THIS IS ME INSIDE THIS CELL</td>
.
.
.
<td><input type="text" name="myname" style="width:100%; border: 0; background: transparent; text-align: center;" value="HELLO THIS IS ME INSIDE THIS CELL"/>
</td>
</tr>
</table>
Output:
Col1 Col2 Col3 Col4 Col5
XYZ HELLO THIS IS ME INSIDE THIS CELL PQR STU HELLO THIS IS
EDIT
I have already came across-ed this question Text input with 100% width inside a td expands/continues outside the td. It is about text overflow outside <td>
but mine deals with text hiding of input element.
Setting the width of both input and table to 100% solves the problem. But, I don't want to set the table width="100%" because it hampers my UI design. Also <td width="30%">
does the trick for that particular column but i don't want to set it manually, it should be done automatically.
so if there is any way to resize td automatically as per input element content than that will surely do the trick. So please help me out.
Thanks