麻烦的div之间的不必要的空间 [英] trouble with unwanted space between divs

查看:122
本文介绍了麻烦的div之间的不必要的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些空间,我不想在类之间。

I have some space that I don't want between classes.

这里是一个小提琴: http://jsfiddle.net/ 4YSXv /

它应该是一个没有任何空格的框:

it should be a box without any spaces in between:

我无法弄清楚如何擦除此空间,我发现它当然,显然是一个常见的问题,但我发现的所有解决方案都没有帮助我。

I can't figure out how to erase this space, i googled it of course and apparently it's a common problem, but all solutions I found didn't help me.

HTML



HTML

       <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>
</div>
<div class='placeholder'>
</div>

CSS

.headerimage {
    position:absolute;
    left:0px;
    right:0px;
    height:273px;
    background-color:#000000;
}
.box1 {
    position:relative;
    top:273px;
}
.produkt {
    width:224px;
    height:318px;
    position:relative;
    float:left;
}
.image {
    width:224px;
    height:230px;
    background-color:#afeeee;
    position:relative;
}
.line1 {
    width:224px;
    height:1px;
    background-color:#000000;
    position:relative;
}
.head {
    width:224px;
    height:25px;
    background-color:#eeeeee;
    position:relative;
}
.subBox {
    width:224px;
    height:50px;
    position:relative;
}
.sub {
    width:224px;
    height:25px;
    position:relative;
}
.price {
    width:160px;
    height:20px;
    background-color:#847077;
    position:relative;
    float:left;
}
.button {
    width:58px;
    height:20px;
    background-color:#6A5ACD;
    position:relative;
    float:left;
}
.line2 {
    width:224px;
    height:5px;
    background-color:#000000;
    position:relative;
    padding-bottom:20px;
}
.placeholder {
    height:800px;
    width:800px;
    position:relative;
    padding-top:1000px;
}


推荐答案

.sub {
    width: 224px;    
    position: relative;    
}

你从.sub的高度得到20px的白色空间

you are getting the white space of 20px from the height of the .sub

还有

.subBox {
width: 224px;
height: 20px;
position: relative;
}

这篇关于麻烦的div之间的不必要的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆