【发布时间】:2016-03-17 23:27:17
【问题描述】:
我需要我的图像宽度为 20%,高度为 20%,但是当我使用 20% 的宽度时,它会将列的宽度拉伸到右侧有很多空白的地方图片。我不想要额外的空格。我该如何解决?
img {
width: 20%;
height: 20%;
}
<table border = '1'>
<tr>
<td> <img src = "http://www.thetimes.co.uk/tto/multimedia/archive/00309/108787995_309592c.jpg" height="42" width="42"> </td>
<td> This is a cat! </td>
</tr>
</table>
【问题讨论】:
-
首先,去掉img标签中的
height="42" width="42"。另外,您的表格宽度在哪里定义?
标签: html css image html-table