您好,我想将表格高度设置为其父 div 的 100%,而无需在 div 中定义高度。我的代码不工作。我不知道我错过了什么。 fiddle link
<div style="overflow:hidden">
<div style="float:left">a<br />b</div>
<table cellpadding="0" cellspacing="0" height="100%" style="border:solid 1px #000000">
<tr>
<td valign="middle">c</td></tr>
</table>
</div>
最佳答案
不为 div 分配高度值是不可能的。
添加这个
body, html{height:100%}
div{height:100%}
table{background:green; width:450px}
关于html - Div 元素内的表格高度 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13877302/