中国开发网: 论坛: 程序员情感CBD: 贴子 809639
张秋桥
适合IE8和其他浏览器的div table cell的解法。IE6/7不守规矩,要另外处理。
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
.container {
display: table;
width: 100%;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
width: 100px;
height: 100px;
background-color:#0F0;
}

.cell2{
display: table-cell;
height: 100px;
background-color:#F00;
}
</style>
</head>

<body>

<!--div>
<div style="width:10px; height: 200px; background-color:#0F0; float: left;"></div>
<div style="width:10px; height: 200px; background-color:#00F; float: right;"></div>
<div style="margin:0 10px; height: 200px; background-color:#F00;"></div>
</div-->

<div class="container">
<div class="row">
<div class="cell">aa</div>
<div class="cell2">bb</div>
<div class="cell">cc</div>
</div>
</div>
</body>
</html>

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录