【发布时间】:2014-06-02 01:52:30
【问题描述】:
注意:这只是 IE 中的问题。
如何强制 textarea 垂直填充表格单元格 div?我已将height: 100% 应用于所有父元素,但 textarea 仍保持其默认高度。
截图:
我的问题示例:JSFiddle
示例代码:
HTML
<div class="table">
<div class="row">
<div class="col col-sm">
<div class="thumbnail">Thumbnail</div>
</div>
<div class="col col-lg">
<textarea>Text area</textarea>
</div>
</div>
</div>
CSS
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.table {
display: table;
width: 100%;
height: 100%;
}
.row {
display: table-row;
height: 100%;
}
.col {
display: table-cell;
border: 1px dashed #FF0000;
padding: 5px;
vertical-align: top;
height: 100%;
}
.col-sm {
width: 30%;
}
.col-lg {
width: 70%;
}
.thumbnail {
height: 150px;
width: 200px;
border: 1px solid #CCC;
}
textarea {
width: 100%;
height: 100%;
}
【问题讨论】:
标签: html css internet-explorer textarea