html - IE 中的表格宽度

标签 html internet-explorer-8 css

enter image description here这可能是一个简单的问题,但我遇到了麻烦:在我的网页中,我有以下内容:

<head>
   <!-- Stuff here -->
</head>

<body>
   <header>
      <div class="content-wrapper">
          <!-- More stuff here... -->
      </div>
   </header>
</body>

哪里content-wrapper在一个 css 文件中并定义了 max-width: 960px .我遇到的问题是 max-width在 IE8 中无效。在正文中,我有一个表格,我认为它应该受到 content-wrapper 中定义的宽度的限制。 , 但在 IE8 中它只是忽略它(但它在 Firefox 中有效)。

我尝试了几种不同的方法,但都没有成功:

  • 已添加 style="max-width:960px"

  • 已添加 style="max-width:960px"<tr>这让我很伤心

  • 已添加 style="width:400px"到有问题的<th><td>

这些都不能在 IE 中工作!有任何想法吗?我错过了什么?

新信息:

我把我的表格放在这样的 div 标签中:

<div style="border: 1px solid; width: 960px">
   <!-- Table comes here -->
</div>

正如您在附图中看到的那样,div 被适本地更改为具有边框和指定的宽度,但表格在 IE8 中忽略它。在 Firefox 中它工作正常。

最佳答案

content-wrapper 的容器必须有 width 以及 IE8 中的 max-width 才能识别它。

看看这篇关于 IE8 和最大宽度的文章: http://www.zeilenwechsel.de/it/articles/5/How-max-width-fails-in-IE8.html

关于html - IE 中的表格宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18214725/

相关文章:

多个元素的CSS类问题

android - 无法弄清楚是什么导致了 IE、Android 和 IOS 中的显示错误

Javascript 'type[...][...]' 为 null 或不是对象 IE8 错误

正在应用 Html CSS 重置,但未兑现

internet-explorer-8 - 合并媒体查询,使用 SASS 和 Breakpoint (Respond-To)

css - 不透明度不适用于 IE8 中的图像

javascript - 如何锁定滚动条并使其可见

html - 按钮和文字不在一条线上

javascript - 在 Foundation 5 上创建和使用自定义模式

javascript - 使用 jquery 的侧边栏功能