我有以下div。假設每個div都向左浮動或將顯示設置爲內聯塊。將div顯示爲行顯示爲div顯示爲列
+-----------+ +-----------+ +--------------+
| 1 | | 2 | | |
+-----------+ | | | 3 |
+-----------+ | |
+--------------+
+-----------+ +-----------+ +--------------+
| 4 | | 5 | | |
+-----------+ | | | 6 |
+-----------+ | |
+--------------+
+-----------+ +-----------+ +--------------+
| | | 8 | | 9 |
| 7 | +-----------+ | |
| | +--------------+
| |
+-----------+
我想要實現這樣的
+-------------+ +-----------+ +-------------+
| 1 | | 4 | | |
+-------------+ +-----------+ | 7 |
+-------------+ +-----------+ | |
| 2 | | 5 | | |
| | | | +-------------+
+-------------+ +-----------+ +-------------+
+-------------+ +-----------+ | 8 |
| | | | +-------------+
| 3 | | 6 + +-------------+
| | | | | 9 |
| | +-----------+ | |
+-------------+ +-------------+
我知道我可以通過逐列,因爲這
<div class="col1">
<div></div>
<div></div>
<div></div>
</div>
<div class="col2">
<div></div>
<div></div>
<div></div>
</div>
<div class="col3">
<div></div>
<div></div>
<div></div>
</div>
,但在我的網站做到這一點有更多的網頁這樣的,所以我希望在不觸及標記的情況下實現。有沒有任何想法用CSS或任何JavaScript/jQuery方法執行此操作?
可能重複絕對div堆棧佈局](http://stackoverflow.com/questions/7109362/how-to-replicate-pinterest-coms-absolute-div-stacking-layout) – Antony