像这样的表:
<table>
<tr>
<td> ... </td>
<td> ... </td>
<td> ... </td>
</tr>
<tr>
<td> ... </td>
<td> ... </td>
<td> ... </td>
</tr>
...
</table>
如何使用div和css display创建一个:table rules?
答案 0 :(得分:23)
试试这个;)
<强> CSS 强>
.table {
display: table;
width: 500px;
}
.tr {
display: table-row;
}
.td {
display: table-cell;
}
<强> HTML 强>
<div class="table">
<div class="tr">
<div class="td">asdf</div>
<div class="td">asdf</div>
<div class="td">asdf</div>
</div>
<div class="tr">
<div class="td">asdf</div>
<div class="td">asdf</div>
<div class="td">asdf</div>
</div>
</div>