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!

Style and width question on an input tag

Status
Not open for further replies.

bkccc

Programmer
Mar 11, 2003
2
US
I want to use an input tag to enter text in a cell in a table. I also would like the input box to fill the entire cell. If I use an inline style and set the width to 100% the input box fills the entire cell even when I resize the the page. The problem is when I set the value for the input tag to some large value the input box grows and causes the cell and the table to grow past the width of my page. How do I set the input tag to fill the entire table cell without causing it to grow when a large value is set?

As you can see below everything works great until I enter a large value in the input tag.
Like: value="some very very large text, etc."

Sample Html:
<table border=&quot;1&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td width=&quot;50%&quot; align=&quot;center&quot;>Label 1</td>
<td width=&quot;50%&quot; align=&quot;center&quot;>Label 2</td>
</tr>
<tr>
<td width=&quot;50%&quot; align=&quot;center&quot;>
<input type=&quot;text&quot; name=&quot;Field1&quot; value=&quot;&quot; style=&quot;width: 100%;&quot;>
</td>
<td width=&quot;50%&quot; align=&quot;center&quot;>
<input type=&quot;text&quot; name=&quot;Field2&quot; value=&quot;&quot; style=&quot;width: 100%;&quot;>
</td>
</tr>
</table>


Thanks In Advance
 
Try to add this to your style attributes :
Code:
<input type=&quot;text&quot; name=&quot;Field1&quot; value=&quot;&quot; style=&quot;width: 100%;
overflow: hidden;
Code:
&quot;>
Water is not bad as long as it stays out human body ;-)
 
Ristmo,

The problem is when the value attribut of the input tag get too large it ignores the percentages and grows the input box too large, which also grows the cell too large. I am using IE 5.5.


Targol,

I have tried adding the overflow: hidden already and that didn't work. I believe it ignored it entirely.


Thanks to both of you for trying. Any more ideas would be greatly appreciated.

bkccc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top