在此示例中,是否可以自动调整<span class="orange">ORANGE</span>
以设置最大行高?并有两个或更多 <span>
的将可以拆分单元格来调整高度?
(现在使用:display: table, table-row, table-cell,也可以使用经典表格)
<html>
<head>
<style>
.table {
display: table;
background: #eee;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
border: 1px solid #000;
}
.cell span {
display: block;
}
.cell span.red {
background: red;
}
.cell span.yellow {
background: yellow;
}
.cell span.green {
background: green;
}
.cell span.orange {
background: orange;
}
.cell span.grey {
background: grey;
}
</style>
</head>
<body>
<div class="table">
<div class="row">
<div class="cell">Header</div>
<div class="cell">Header</div>
<div class="cell">Header</div>
<div class="cell">Header</div>
</div>
<div class="row">
<div class="cell">Row 1</div>
<div class="cell">Row 1</div>
<div class="cell">Row 1</div>
<div class="cell">Row 1</div>
</div>
<div class="row">
<div class="cell">
<span class="red">RED</span>
<span class="yellow">YELLOW</span>
<span class="green">GREEN</span>
<span class="orange">ORANGE</span>
<span class="grey">GREY</span>
</div>
<div class="cell">Row 2</div>
<div class="cell">Row 2</div>
<div class="cell">
<span class="orange">ORANGE</span>
</div>
</div>
<div class="row">
<div class="cell">
<span class="red">RED</span>
<span class="yellow">YELLOW</span>
<span class="green">GREEN</span>
<span class="orange">ORANGE</span>
<span class="grey">GREY</span>
</div>
<div class="cell">Row 2</div>
<div class="cell">Row 2</div>
<div class="cell">
<span class="green">GREEN</span>
<span class="orange">ORANGE</span>
</div>
</div>
</div>
</body>
</html>