我想使用CSS3列從上到下排列一些div,然後從左到右。它似乎工作得很好,但我有這個問題如下圖所示。我爲每個div都提供了一個背景,當我調整窗口的高度時,不是像我想的那樣將整個背景移動到一個塊中,而是逐漸添加它,將兩列之間的背景分開。這看起來真的很糟糕。我想知道是否有辦法保留我的div背景,這樣一旦窗口變得太小而無法容納div的一個像素高度,它就會將整個div移動到下一列。CSS3列背景截止
其次,我想在窗口大小的頁面中心列的中心。我想這在Chrome(任何最新版本),Firefox(所有最新版本)的工作,和IE 10
您可以在這裏搗鼓:http://jsfiddle.net/eE3z6/
#mainContent /* The containing div */
{
position: absolute;
top: 50px;
bottom: 50px;
margin: 10px;
column-width: 400px;
-webkit-column-width: 400px;
-moz-column-width: 400px;
}
.blockData /* The divs inside are all of this class */
{
position: relative;
width: 380px;
height: 30px;
padding: 4px;
margin: 0px 0px 10px 0;
border: 4px outset grey;
background: lightgrey;
}
關於分欄符的一些有趣討論可以在以下網址找到:http://trentwalton。COM/2012/02/13/CSS-列符/ –