IE中的CSS显示表

use*_*025 3 html css internet-explorer css-tables

我有以下代码和CSS.它适用于Chrome,但不适用于IE.有没有办法让它在IE中运行?

CSS:

<style type="text/css">
        .table {width:100%;height: 1%;background-color: lime;display: table;border-collapse: collapse;}
        .row {display: table-row;}
        .centercell {vertical-align: top;display: table-cell;background-color: #0f0;}
        .top{background-color:yellow;width:100%;height:20px;z-index: 1;position: relative;}
        .bottom{background-color:yellow;width:100%;height:20px;z-index: 1;position: relative;}
        .middle{background-color:pink;width:100%;height: 100%;margin: -20px 0px;position: relative;padding: 20px 0px;}
        .rightcell {vertical-align: top;background-color: #f00;display: table-cell;width:155px;background-image: url('img/bg1.gif');background-repeat:repeat-y}
        .leftcell {vertical-align: top;background-color: #f00;display: table-cell;width:171px;}
    </style>
Run Code Online (Sandbox Code Playgroud)

HTML:

<div class="table">
<div class="row">
    <div class="leftcell">
        right column
    </div>
    <div class="centercell">
        <div class="top">center top</div>
        <div class="middle">center middle</div>
        <div class="bottom">center bottom</div>
    </div>
    <div class="rightcell">
        right column<br> 
        right column<br> 
        right column<br> 
        right column<br> 
        right column<br> 
        right column<br> 
        right column<br> 
        right column<br> 
    </div>
</div>    
Run Code Online (Sandbox Code Playgroud)

Chu*_*utt 7

IE7不支持display:table,你的代码在IE8,IE9和IE10中看起来很好.所以要么你必须使用实际的,<table>或者如果它是一个选项,则使用floats代替.

别担心,我很害怕.

编辑:显然这是您的页面布局.你不应该使用<table>或display:table.只是漂浮一些DIV男人!

  • 哦,这并不像您想的那么简单... http://stackoverflow.com/questions/1205159/html-css-making-two-floating-divs-the-same-height .. esp。当您不想每次都要修改CSS(填充)时,您需要在div中添加另一个换行元素。 (2认同)