我有3個表,一個接一個地級聯。我有一個div,我想放在這些表格的右側。 div的高度可能會因文字內容而異。目前div顯示在表格下方,如下圖所示;如何在級聯表的右側放置div - CSS
<table class="class1" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell1</td>
<td class="cell2">Cell2</td>
</tr>
<tr>
<td class="cell1">Cell3</td>
<td class="cell2">Cell4</td>
</tr>
</table>
<table class="class2" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell5</td>
<td class="cell2">Cell6</td>
</tr>
<tr>
<td class="cell1">Cell7</td>
<td class="cell2">Cell8</td>
</tr>
</table>
<table class="class3" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell9</td>
<td class="cell2">Cell10</td>
</tr>
<tr>
<td class="cell1">Cell11</td>
<td class="cell2">Cell12</td>
</tr>
</table>
<div class="mydiv">mydiv</div>
但我想股利放在旁邊的桌子,以便它可以向下延伸。
這裏是工作提琴http://jsfiddle.net/ZHVuf/1/
+1 clearfix – Saju 2013-03-09 10:44:49
+1我喜歡的第一個例子更好,因爲你需要更少的標記和下面的塊級元素可以簡單地「明確:兩者;」將其放置在其他元素的下方。你也可以通過刪除* clearfix *來簡化第二個例子,並簡單地在'wrapper'上使用這一行:'overflow:hidden;'。 – insertusernamehere 2013-03-09 11:03:00
嗯,我不明白你的評論,我從來沒有用過隱藏的^^。在某些情況下,清除這兩個可能都不夠,所以我更喜歡這個漂亮的clearfix。 – soyuka 2013-03-09 11:08:15