我有一个表格,其中有两行。
看起来像这样:
—————————————————
| 1 | 2 |
|———————————————|
| 3 | |
—————————————————
第一行有两个单元格,但第二行只有一个。
我该如何使第二行的唯一表格单元格与第一行的第二个表格单元格对齐?(不在第二行的单元格前添加单元格)
像这样:
—————————————————
| 1 | 2 |
|———————————————|
| | 3 |
—————————————————
这是我的HTML:
<div class="table">
<div class="row">
<div class="cell one">
1
</div>
<div class="cell two">
2
</div>
</div>
<div class="row">
<div class="cell three">
3
</div>
</div>
</div>
我的CSS:
div.table {
display:table;
background:#EEE;
padding:10px;
}
div.row {
display:table-row;
background:#610;
padding:10px;
width:100%;
text-align:right;
}
div.cell {
display:table-cell;
background:#016;
padding:10px;
color:white;
font-family:sans-serif;
}
我已经尝试过边距和浮动。如果可能的话,我想避免使用绝对定位和浮动。