html - 显示 :table & display:table-cell not working in IE9

标签 html css internet-explorer cross-browser

Salam(意思是你好):)

我正在尝试使用 display:tabledisplay:table-cell 为我的网页实现 3 列布局。它在 firefox 和 chrome 中运行良好,我知道 this feature should be supported in IE 9 ,但到目前为止我所取得的成就不过是这张截图:

enter image description here

我怎样才能让它在 IE 8+ 中工作?

这是我的完整代码:

( JS Fiddle 可用)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
    <title>test</title>
    <meta http-equiv="Content-Type" Content="text/html;charset=UTF-8">
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            width:100%;
            margin:0;
            padding:0;
        }
        .container{
            display:table;
            width:100%;
            border-collapse:separate;
        }
        .col{
            display:table-cell;
        }
        .side-1{
            width:200px;
            background: #efefef;
        }
        .side-2{
            width:200px;
            background: #f8f8f8;
        }
        .content{

        }
        #header,#footer{
            height:40px;
            background: #e4f3fd;
        }
    </style>
</head>
<body>
<div id="header">header</div>
<div class="container">
    <div class="col side-1">
        sidebar 1
        <br>.<br>.<br>.
    </div>
    <div class="col side-2">
        sidebar 2
        <br>.<br>.<br>.
    </div>
    <div class="col content">
        content
        <br>.<br>.<br>.
    </div>
</div>
<div id="footer">footer</div>
</body>
</html>

最佳答案

问题是 IE 无法呈现最新版本的页面,adding a X-UA-Compatible meta tag让我们选择应该呈现页面的 IE 版本,将其设置为最新(边缘)版本可以解决问题:

<meta http-equiv="X-UA-Compatible" content="IE=edge">

关于html - 显示 :table & display:table-cell not working in IE9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21803840/

相关文章:

css - 如何为 SPA 应用程序制作响应式和可滚动的主面板?

css - Domsanitizer bypasssecuritytruststyle 在 ie 11 中不起作用

html - Internet Explorer 中的图像上的文本

javascript - 切换除一项之外的所有选项,然后切换异常(exception)的一项?

javascript - 不允许在文本框验证中使用特殊字符

html - CSS 两个边框。不同的高度

html - 媒体查询在更改屏幕分辨率时不起作用,但在更改宽度和高度时起作用谷歌响应式开发人员工具检查

html - 3 个相邻的 100% 大小的 div,另一个作为包含流畅照片的背景

html - CSS:从元素本身获取边框颜色

CSS 字体平滑 HTML 电子邮件