【问题标题】:IE 10 forces strict modeIE 10 强制严格模式
【发布时间】:2012-12-21 11:31:54
【问题描述】:

考虑以下 HTML 代码:

<style> td, tr { border:1px solid gray; } </style>
<table class="tableinfo" cellspacing="1" cellpadding="3">
  <tr>
    <td>asd</td>
    <td>bsd</td>
  </tr>
  <tr style="display: block;" >
    <td class="">ttt</td>
    <td class="">asd</td>
  </tr>
</table>

使用文档类型:

<!doctype html>

在 IE9 中一切正常,但在 IE10 中表损坏:

为什么会这样?

如何解决这个问题?

一种解决方案是添加以下内容:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />

但这会破坏整个项目的样式。

【问题讨论】:

    标签: html html-table internet-explorer-10 compatibility-mode


    【解决方案1】:

    IE10 不像 IE9 那样工作,IE9 不像 IE8/7/6 等那样工作,而且它们都不像其他更现代的浏览器那样工作。您在 IE10 中的示例也是它在现代浏览器中的工作方式,因此 IE9 行为不端。除非您使用了错误的文档类型,否则更改文档类型永远不是解决方案。您的解决方案使用了错误的解决方案并让您进入怪癖模式。

    【讨论】:

    • 是的 IE9 行为不端将 'block' 更改为 'table-row' 并且工作正常。我相信我从 IE6 开始就有那个代码,其中“table-row”可能不起作用。遗留代码的魅力:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-26
    • 2013-09-06
    • 1970-01-01
    • 1970-01-01
    • 2016-11-09
    • 2012-09-10
    • 2018-07-18
    相关资源
    最近更新 更多