2014-02-15 143 views
1

萨拉姆(意味着你好)不工作:)显示:表&显示:表细胞在IE9

我想实现一个3栏布局使用display:table & display:table-cell我的网页。它工作正常在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> 
+2

工作的f或我与IE8,但请注意,使用*表*或CSS *表*显示元素[不适合布局的目的](http://stackoverflow.com/questions/21378240/liquid-layout-with-liquid-left -fixed右列/ 21378465#21378465)。还有一件事,在CSS *表格布局*中,所有元素[应遵循相同的结构属性](http://stackoverflow.com/questions/18516836/how-to-approximate-table-layout-with-css-when - 结构 - 是-脱节/ 18516881#18516881)。 –

回答

10

的问题是,IE浏览器不显示页面,因为它的最新版本,adding a X-UA-Compatible meta tag让我们选择哪个版本IE应呈现页面,将其设置为最新(边缘)版本可解决问题:

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

如果这没有帮助,该怎么办?我的网站几乎可以在除IE以外的所有浏览器中使用 –