Reputation: 3699
What is the reason that this image doesn't stretch its height to be as it's width?
In Webkit only!
Edit: lot of people are having trouble, just use Chrome
Upvotes: 0
Views: 492
Reputation: 3699
This is the best that you can do: 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%;
}
Upvotes: 0
Reputation: 23992
Unless you have multiple tables and multiple images for different data to layout, you can define same style for the table
or td
with img
and this should work in Chrome
as well with IE
and Firefox
.
Sample on Fiddle at http://jsfiddle.net/2BdQT/
or
css:
table, img
{
height:40px;
width:40px;
}
td,tr,tbody
{
width:100%;
height:100%;
}
html:
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.google.com/logos/2012/stgeorge12-hp.png"></td>
</tr>
</table>
Upvotes: 1