我希望在第二个示例中的行之间没有边距。所有行都应具有与示例1相同的边距。请注意,我是动态填充这些表的,所以我不知道有多少行被填充了。
.marker-img-column {
background-color: #ffffff;
text-align: center;
margin: 0;
padding: 0 0 0 1em;
width: 20em;
}
.marker-img {
max-height: 300px;
max-width: 400px;
width: 275px;
height: auto;
margin: 0;
padding: 0;
}
<html>
<h2>Everything is filled in</h2>
<table>
<tr>
<td colspan="3">
Name1
</td>
</tr>
<tr>
<td>Materials Used:</td>
<td>
product 1, product 2, product 3
</td>
<td rowspan="10" class="marker-img-column"><img class="marker-img" src="https://fastly.picsum.photos/id/11/2500/1667.jpg?hmac=xxjFJtAPgshYkysU_aqx2sZir-kIOjNR9vx0te7GycQ" alt="Image marker name" /></td>
</tr>
<tr>
<td>
Compartment:
</td>
<td>
Building
</td>
</tr>
<tr>
<td>Fire rating:</td>
<td>
EI120
</td>
</tr>
<tr>
<td>Compartment type:</td>
<td>
Wall
</td>
</tr>
<tr>
<td>Materials:</td>
<td>
Material 1, Material 2, Material 3
</td>
</tr>
<tr>
<td>Penetration size (W x H):</td>
<td>
40 x 50
</td>
</tr>
<tr>
<td>Pipe type / size:</td>
<td>
type / 50 mm
</td>
</tr>
<tr>
<td>Wall tickness:</td>
<td>
55 mm
</td>
</tr>
<tr>
<td>Installation date:</td>
<td>
21/09/2023
</td>
</tr>
<tr>
<td>Comments:</td>
<td>
comment 1, comment 2, comment 3
</td>
</tr>
</table>
<h2>Some values are filled in</h2>
<table>
<tr>
<td colspan="3">
Name1
</td>
</tr>
<tr>
<td>Materials Used:</td>
<td>
product 1, product 2, product 3
</td>
<td rowspan="10" class="marker-img-column"><img class="marker-img" src="https://fastly.picsum.photos/id/11/2500/1667.jpg?hmac=xxjFJtAPgshYkysU_aqx2sZir-kIOjNR9vx0te7GycQ" alt="Image marker name" /></td>
</tr>
<tr>
<td>
Compartment:
</td>
<td>
Building
</td>
</tr>
<tr>
<td>Installation date:</td>
<td>
21/09/2023
</td>
</tr>
</table>
</html>
还有一个CodePen文档:https://codepen.io/SDG6/pen/JjwMOyZ
1条答案
按热度按时间5gfr0r5j1#
在第二个示例中,左侧的表格行按比例增长,以填充右侧图像指定的最小高度。
这里有一个替代方案,用css-grid替换表: