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)
IE7不支持display:table,你的代码在IE8,IE9和IE10中看起来很好.所以要么你必须使用实际的,<table>或者如果它是一个选项,则使用floats代替.
别担心,我很害怕.
编辑:显然这是您的页面布局.你不应该使用<table>或display:table.只是漂浮一些DIV男人!