我有一张 table 。有些 td 是空的,有些看起来像这样:
<td><div class='divintd'>+</div></td>
具有非空 td 的行会调整其高度和宽度。我从 StackOverflow 存档中发现,将 td 放在 div 中是唯一的选择。我实现了此处建议的代码:How to fix height of TR? , 但我的 table 还是搞砸了。我做错了什么,我该如何解决? CSS:
table td {
width: 4px;
height: 4px;
}
.divintd {
width: 100%;
height: 100%;
max-height: 100%;
max-width: 100%;
overflow: hidden;
}
最佳答案
第一个变化
<td><div class='divintd'>+</div></td>
进入
<div class='divintd'><td>+</td></div>
.divintd td {
width: 100%;
height: 100%;
max-height: 100%;
max-width: 100%;
overflow: hidden;
}
关于html - 在 td 中使用 div 固定表格行高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23196371/