【发布时间】:2019-06-23 15:46:37
【问题描述】:
我有以下 HTML/CSS 结构:
table {
table-layout: fixed;
width: 100%;
height: 100%;
}
#quad-main {
position: absolute;
top: 2.5%;
right: 2.5%;
width: 95%;
height: 20%;
border: 1px #000 solid;
}
.left-align {
text-align: left;
}
.logo-img-style {
width: 100%;
height: 100%;
}
#lbl-logo {
width: 100%;
height: 100%;
object-fit: contain;
}
<div id="quad-main">
<table>
<tr>
<th class="left-align">
<div class="logo-img-style">
<img id="lbl-logo" src="a_img.png" />
</div>
</th>
</tr>
</table>
</div>
问题是:为什么表格比主 div(“quad-main”)大?
如果四主维度是固定的(并且它们是),并且表格具有 100% w 和 100% h(这意味着完全适合父维度),为什么在我的图形视图中表格看起来比 div 大?
所有子表也有 100% 的高度,所以它们不能大于表,理论上不能大于第一个 div。
同时设置 max-width 和 max-height 不会改变任何东西。
有什么想法吗?
【问题讨论】: