0

So I am trying to make a box with 4 div boxes inside it. The 4 sub div boxes are all on the same horizontal axes. It looks fine except the outside border from the parent div is just a line on the top for some reason. So the children divs I think are not inside the parent. I think I messed up something in the css. HTML:

<div class="summaryBox">
        <div class="img1">
            <p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
        </div>
        <div class="sum1">
            <p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
        </div>
        <div class="img2">
            <p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
        </div>
        <div class="sum2">
            <p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
        </div>
</div>

CSS:

.summaryBox {
        border: 1px solid green ;
        width: 80%;
        margin: auto;
}

.summaryBox .img1 {
        width: 17%;
        float: left;
        color: white;
        padding: 0px .5% 0px .5%;
}

.summaryBox .img2 {
        width: 17%;
        float: left;
        color: white;
        padding: 0px .5% 0px .5%;
}

.summaryBox .sum1 {
        width: 17%;
        float: left;
        color: white;
        padding: 0px .5% 0px .5%;
}

.summaryBox .sum2 {
        width: 17%;
        float: left;
        color: white;
        padding: 0px .5% 0px .5%;
}
samuelk71
  • 311
  • 1
  • 3
  • 11
  • 1
    it is because of `float` issue you will need to clear the floats one example is `.summaryBox:after { content:''; clear:both; display:table; }` add this it will clear the floats or add `overflow:hidden` to `. summaryBox ` – Vitorino fernandes Oct 23 '15 at 04:56
  • Possible duplicate of [Which method of ‘clearfix’ is best?](http://stackoverflow.com/questions/211383/which-method-of-clearfix-is-best) – Michael Benjamin Oct 23 '15 at 04:58
  • Thank-you for the answer and explanation! – samuelk71 Oct 23 '15 at 04:59

0 Answers0