如何使文本区域适合表格单元格

我在表格的输入中显示了一个文本区域。但我想调整它的大小,使其覆盖整个表格单元格,直到边框。


逻辑——


<textarea type="textarea" value="{{data.directRowNo}}" id = "abc"

></textarea></td>

我使用的 css 是 -


  #abc{

width: 100%;

height: 443%;

box-sizing: border-box;

resize: vertical;

max-height: 500px;

}

图片 -

http://img1.mukewang.com/61a874a40001cc9801130093.jpg

出现了我不想要的分叉线。


ibeautiful
浏览 139回答 3
3回答

梦里花落0921

是这你在找什么?CSStable {&nbsp; &nbsp; width: 500px;&nbsp; &nbsp; margin: 20px auto;&nbsp; &nbsp; border-collapse:collapse;&nbsp; &nbsp; border-spacing: 0;}table td {&nbsp; &nbsp; background-color: red;&nbsp; &nbsp; border: 0;&nbsp; &nbsp; min-height: 20px;}textarea {&nbsp; &nbsp; border: none;&nbsp; &nbsp; width: 100%;&nbsp; &nbsp; -webkit-box-sizing: border-box; /* <=iOS4, <= Android&nbsp; 2.3 */&nbsp; &nbsp; -moz-box-sizing: border-box; /* FF1+ */&nbsp; &nbsp; box-sizing: border-box; /* Chrome, IE8, Opera, Safari 5.1*/}HTML<table>&nbsp; &nbsp; <tr>&nbsp; &nbsp; &nbsp; &nbsp; <td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cell&nbsp; &nbsp; &nbsp; &nbsp; </td>&nbsp; &nbsp; </tr>&nbsp; &nbsp; <tr>&nbsp; &nbsp; &nbsp; &nbsp; <td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <textarea></textarea>&nbsp; &nbsp; &nbsp; &nbsp; </td>&nbsp; &nbsp; </tr>&nbsp; &nbsp; <tr>&nbsp; &nbsp; &nbsp; &nbsp; <td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cell&nbsp; &nbsp; &nbsp; &nbsp; </td>&nbsp; &nbsp; </tr></table>上面的代码将<textarea>与单元格一起调整大小,并将拉伸textarea直到单元格边框。

慕雪6442864

尝试textarea{width:100%;height:100%;&nbsp;resize: none;}

慕桂英3389331

尝试将 td 的填充设置为 0:https : //jsfiddle.net/upb51sth/td {&nbsp; background-color: red;&nbsp; padding: 0;}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript