Reputation: 4692
.. been trying to fit the textbox (auto adjust the textbox width) within HTML table's cell but no luck.. can anyone please help? thanks
What I have:
<td>
<asp:TextBox ID="txtPrice" runat="server" style="width:100%"/>
</td>
Upvotes: 12
Views: 40119
Reputation: 11098
This works for me:
<asp:TextBox ID="txtPrice" runat="server" width=100%"/>
However, there is overflow to the left I'll see what I can do
Upvotes: 3
Reputation: 67194
"Textboxes" like <textarea>
are inline elements. You need to make this:
HTML:
<textarea class="myTextarea">
Content
</textarea>
CSS:
.myTextarea
{
display: block;
width: 100%;
height: 100%;
}
And an updated example for you here. (With margins added and a table for you to see it working in)
Also, do you have some code we can see? textbox
isn't valid HTML so we have no idea what you're trying to use :)
Upvotes: 12
Reputation: 51797
set your "textbox" (whatever that is... do you mean textarea
or an input type="text"
?) to 100% width
and hight
and it's margin
to 0 and set the padding
of your table-cell to 0.
Upvotes: 0
Reputation: 16060
Try this:
<td>
<textarea style="width:100%;height:100%;margin:0;padding:0;" rows=1 cols=1>
text!
</textarea>
</td>
in my tests, it worked.
Upvotes: 4