2012-02-06 72 views

回答

3

可以使用column-count屬性這種類型的函數:

檢查我以前的答案這個

I want to show list items as 2 or more columns (dynamic alignment)

+0

我的contentDiv具有指定的高度,並且消息具有動態高度(有時候只有一個單詞...有時候是一個包含10個單詞的文本)。編輯:好吧,它的作品。真的很好的解決方案!謝謝! http://jsfiddle.net/pMbtk/33/ – user970727 2012-02-06 12:18:46

+0

很高興幫助:) – sandeep 2012-02-06 12:22:05

-2

我在你的榜樣試過這樣:

.message { 

width:90px; 
margin:3px; 
background-color:#dfdfdf; 
position:absolute; 

} 

,它可以幫助。

好運!

+0

這不起作用 – 2012-02-06 12:06:48

-1

從contentDiv中刪除高度,並將其放入float:left;以便它包裝您的內容。

http://jsfiddle.net/ZWxGW/5/

+0

這不正是他要求的,是嗎? – Jasper 2012-02-06 12:09:17

+0

高度很重要(不能改變它),當我添加浮點數時:左邊的順序(從上到下)是不正確的。 – user970727 2012-02-06 12:10:04

+0

需要更多說明。 – Gurvinder 2012-02-06 12:17:53

0
.message { 

width:90px; 
margin:3px; 
background-color:#dfdfdf; 
float : left; 
} 

如果從左到右,從上到下的作品出來你試試這個。

0


1)在這種情況下,你必須要列格(紅色在圖像中),你必須把其他div 1,2,3,4在這個div裏面......如圖所示
arrangement give belo w屬性div。

.message,.outer_div {
float:left;
身高:自動;
width:200px;
}


2)在另一起案件中,如果你從左至右,從上到下想
,那麼你就需要有一個外的div ...在紅色

規定
0

你可以試試這個...

ul { 
    width:60px; height: 60px; 
} 

ul li{ 
    float:left; 
    width:20px; 
    list-style:none; 
} 
ul, ul li { 
    -moz-transform: rotate(-90deg) scaleX(-1); 
    -o-transform: rotate(-90deg) scaleX(-1); 
    -webkit-transform: rotate(-90deg) scaleX(-1); 
    -ms-transform: rotate(-90deg) scaleX(-1); 
    transform: rotate(-90deg) scaleX(-1); 
    /* IE8+ - must be on one line, unfortunately */ 
    -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=-3.061616997868383e-16, M12=1, M21=1, M22=3.061616997868383e-16, SizingMethod='auto expand')"; 

    /* IE6 and 7 */ 
    filter: progid:DXImageTransform.Microsoft.Matrix(
      M11=-3.061616997868383e-16, 
      M12=1, 
      M21=1, 
      M22=3.061616997868383e-16, 
      SizingMethod='auto expand'); 
} 

未經測試的IE http://jsfiddle.net/rlemon/Y5ZvA/3/