首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >IE 8-10表中的图像太大了

IE 8-10表中的图像太大了
EN

Stack Overflow用户
提问于 2014-08-19 08:28:23
回答 1查看 120关注 0票数 0

我有个小问题我解决不了。

请看我的html和我的css。为什么这些图片在safarifirefoxchrome中都有很好的响应,而在IE 8到10中却没有呢?

html:

代码语言:javascript
运行
复制
<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:

代码语言:javascript
运行
复制
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;
}

我对htmlcss这两方面都很陌生。我想保留这张桌子,因为它给了我一个很好的布局,但我对解决我的问题的每件事都很开放。

有人能帮我吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-19 08:40:00

显然,height="auto"在不同的浏览器中实现不同。不能依靠的东西。

但是,如果你去掉它,图像可能会超过它们的空间。

尝试省略height属性,并添加到css中:

代码语言:javascript
运行
复制
table.my-table td img{
   max-height: 100%;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25378818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档