如何适应文本在表格单元格 [英] how to fit textbox in the table cell

查看:111
本文介绍了如何适应文本在表格单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

..一直在努力适应文本框(自动调整文本框的宽度)HTML表格的单元格中,但没有运气..任何人都可以请帮助?谢谢

我有什么:

 < TD>
  < ASP:文本框ID =txtPrice=服务器的风格=宽度:100%/>
< / TD>


解决方案

文本框像< TextArea> 是内联元素。你需要做的:

HTML

 < TextArea类=myTextarea>
内容
< / textarea的>

CSS:

  .myTextarea
{
   显示:块;
   宽度:100%;
   高度:100%;
}

实例为你这里

而对于你这里更新的例子。 (随着利润增加和一张桌子给你看它的工作中)

另外,你有一些code,我们可以看到? 文本是无效的HTML,所以我们不知道你想用什么:)

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

解决方案

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

这篇关于如何适应文本在表格单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆