我有个小问题我解决不了。
请看我的html和我的css。为什么这些图片在safari
,firefox
,chrome
中都有很好的响应,而在IE 8
到10中却没有呢?
html:
<table class="my-table">
<tbody>
<tr>
<td height="130"><a href="http://www.kc-werbeartikel.com" target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/sponsoren/kuratli.gif" alt="Kuratli Collection" width="100%" height="auto" /></a> </td>
<td height="130"><a href="http://www.migros.ch" target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/sponsoren/Logo_Migros.JPG" alt="Migros" width="100%" height="auto" /></a> </td>
<td height="130"><a href="http://www.gartenbau-weber.ch" target="_blank"><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/sponsoren/Logo_Webergartenbau.gif" alt="Webergartenbau" width="100%" height="auto" /></a> </td>
</tr>
</tbody>
</table>
css:
table.my-table td {
width: 33% !important;
border: 1px solid #dddddd !important;
}
table.my-table {
width: 100% !important;
table-layout: fixed !important;
border-spacing: 0.5rem !important;
border-collapse: separate !important;
}
我对html
和css
这两方面都很陌生。我想保留这张桌子,因为它给了我一个很好的布局,但我对解决我的问题的每件事都很开放。
有人能帮我吗?
发布于 2014-08-19 08:40:00
显然,height="auto"
在不同的浏览器中实现不同。不能依靠的东西。
但是,如果你去掉它,图像可能会超过它们的空间。
尝试省略height
属性,并添加到css中:
table.my-table td img{
max-height: 100%;
}
https://stackoverflow.com/questions/25378818
复制相似问题