Facebook时间线样式css/html



我有一个问题,我不能把盒子一个放在另一个下面,它们之间有一段距离,你能帮我吗?这些盒子有一个间隙,意思是排列在一行,而不是像我那样一个在另一行下面。

time, .time {
    font-size: 10px;
    color:gray;
    border-bottom: 1px solid #E7EBF2;
    min-width:350px;
    height:20px;
    padding-bottom: 5px;
}
#timeline {
    width:846px;
    list-style:none;
    list-style-type: none;
    background: url('../imgs/timeline.png') top center repeat-y;
    margin: 0 auto;
    padding:20px;
    margin-bottom:10px;
}
#timeline li {
    width:390px;
    -moz-border-radius:2px;
    border-radius:2px;
    webkit-border-radius:2px;
    border:1px solid #c3ccdf;
    padding:5px;
    background-color:#FFF;
}
#timeline li:nth-of-type(odd) {
    clear: both;
    float:right;
}
#timeline li:nth-of-type(odd), #timeline li:nth-of-type(even) {
    margin:-10px 0 20px 0;
}
#timeline li:nth-of-type(even) .corner {
    position:absolute;
    display:block;
    margin-left:383px;
    width:20px;
    height:15px;
    background:url('../imgs/right.png');
}
#timeline li:nth-of-type(odd) .corner {
    position:absolute;
    display:block;
    margin-left:-25px;
    width:20px;
    height:15px;
    background:url('../imgs/left.png');
}

这是演示http://jsfiddle.net/jT5e9/1/

这是因为这里有clear: both;

#timeline li:nth-of-type(odd) {
    clear: both;
    float:right;
}

另外,我在#timeline li中添加了float:left,它对我很有效。http://jsfiddle.net/jT5e9/2/

最新更新