我刚问了这个问题'trouble with unwanted space between divs'
现在我遇到了一个新问题...对于我的布局,我需要将此框倍增8次,如下所示:
之前有效,但是现在(在我擦除高度之后)我得到了这个:
这是一个小提琴:http://jsfiddle.net/m5t6e/ 这是代码:
HTML(重复8次):
<div class='image'></div>
<div class='line1'></div>
<div class='head'></div>
<div class='subBox'>
<div class='sub'></div>
<div class='price'></div>
<div class='button'></div>
</div>
<div style='clear:both;'></div>
<div class='line2'></div>
<div class='placeholder'></div>
CSS:
.headerimage {
background-color:#000;
height:273px;
left:0;
position:absolute;
right:0;
}
.box1 {
position:relative;
top:273px;
}
.produkt {
float:left;
height:318px;
position:relative;
width:224px;
}
.image {
background-color:#afeeee;
height:230px;
position:relative;
width:224px;
}
.line1 {
background-color:#000;
height:1px;
position:relative;
width:224px;
}
.head {
background-color:#eee;
height:25px;
position:relative;
width:224px;
}
.subBox {
height:50px;
position:relative;
width:224px;
}
.sub {
height:25px;
position:relative;
width:224px;
}
.price {
background-color:#847077;
float:left;
height:20px;
position:relative;
width:160px;
}
.button {
background-color:#6A5ACD;
float:left;
height:20px;
position:relative;
width:58px;
}
.line2 {
background-color:#000;
height:5px;
padding-bottom:20px;
position:relative;
width:224px;
}
.placeholder{
height:800px;
width:800px;
position:relative;
padding-top:1000px;
}
答案 0 :(得分:-1)
删除.placehodler
CSS样式
将每个元素封装在div
将封装的div
设置为float:left
,行为类似于display:inline-block
div
在每4个街区后插入<br>
检查此jsFiddle