how to fit textbox in the table cell

后端 未结 5 1744
闹比i
闹比i 2021-02-20 06:49

.. 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:

&l         


        
相关标签:
5条回答
  • 2021-02-20 06:56

    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

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-20 07:06

    "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%;
    }
    

    Example for you here.

    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 :)

    0 讨论(0)
  • 2021-02-20 07:13

    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.

    0 讨论(0)
  • 2021-02-20 07:14

    style="width: 100%; height: 100%;" does not work?

    0 讨论(0)
提交回复
热议问题