0

该图像没有将其高度拉伸为宽度的原因是什么?

仅在 Webkit 中!

http://jsfiddle.net/CgEhg/8/

编辑:很多人遇到麻烦,只需使用 Chrome

4

3 回答 3

1

除非您有多个表格和多个图像用于不同数据的布局,否则您可以为tableor定义相同的样式,这应该td与and一起使用。 imgChromeIEFirefox

Fiddle 上的示例http://jsfiddle.net/2BdQT/

或者

CSS

table, img
{
    height:40px;
    width:40px;
}

td,tr,tbody
{
    width:100%;
    height:100%;
}

​<strong>html:

<table  border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><img src="http://www.google.com/logos/2012/stgeorge12-hp.png"></td>

    </tr>
</table>

​</p>

于 2012-05-10T02:27:27.640 回答
0

您需要样式tdtable不是img标签

jsFiddle

于 2012-05-10T01:47:13.407 回答
0

这是你能做的最好的:http: //jsfiddle.net/CgEhg/41/

<table  border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><img src="http://www.google.com/logos/2012/stgeorge12-hp.png" /></td>       
    </tr>
</table>

table{
    height:40px;
    width:40px;
}    
img{
    height:auto;
     width:100%;
}
td,tr,tbody{
    height:100%;
    height:100%;
}
于 2012-05-11T16:29:38.180 回答