2014-03-03 30 views
0

我的小提琴:http://jsfiddle.net/f5e5d/1/自動轉DIV的(CSS)

.item-data { 
    width:34px; 
    height:34px; 
    background-size: 34px auto !important; 
    margin: 2px; 
    border: 1px solid #000; 
    display:table-cell; 
} 
.test_div { 
    background-color: #eee; 
    width: 100%; 
    padding: 20px; 
} 
.match_details { 
    display:table-cell; 
} 

我想只顯示3在一行中的圖片。我該怎麼做?

現在我已經在1行中顯示了所有6項。

在此先感謝!

回答

3

像這樣:http://jsfiddle.net/NicoO/f5e5d/4/

.item-data { 
    width:34px; 
    height:34px; 
    background-size: 34px auto !important; 
    margin: 2px; 
    border: 1px solid #000; 
    float: left; 
} 

.item-data:nth-child(3n+1) 
{ 
    clear: left; 
} 

.test_div { 
    background-color: #eee; 
    overflow: hidden; 
    padding: 20px; 
}