* {
box-sizing: border-box;
}
.box {
float: left;
width: 33.33%;
padding: 50px;
}
<h2>Grid of Boxes</h2>
<p>Float boxes side by side:</p>
<div class="big-box" style="margin-bottom:30px;">
<div class="box" style="background-color:#bbb">
<p>Some text inside the box.</p>
</div>
<div class="box" style="background-color:#ccc">
<p>Some text inside the box.</p>
</div>
<div class="box" style="background-color:#ddd">
<p>Some text inside the box.</p>
</div>
</div>
<p style="clear:both;">Note that we also use the clearfix hack to take care of the layout flow, and that add the box-sizing property to make sure that the box doesn't break due to extra padding. Try to remove this code to see the effect.</p>
in the above code margin-bottom:30px
on div
with class = big-box
is not working.WHY???
I also need suggestions how can I apply margin bottom in this kind of scenerio.
I am very new to CSS and this might be a very silly questions or code may contain some silly errors.