The parent div "block" has a position: relative. Instead of expanding automatically to assume a height of the total of its children's heights, it takes up the height of the first child only. Can you please explain why is that happening and how to counter it?
.grid {
position: relative;
z-index: 1;
float: left;
margin: 3px;
}
.grid a {
text-decoration: none;
}
.grid .p7 {
width: 240px;
height: 300px;
border: 1px solid crimson;
}
.blocks {
position: relative;
}
.blocks .heading a {
text-decoration: none;
}
.blocks .heading a h3 {
text-transform: uppercase;
font-size: 28px;
font-family: "Rokkitt";
font-weight: 700;
padding: 0 3px;
line-height: 26px;
color: #222;
text-align: center;
}
.blocks .heading a p {
font-size: 16px;
font-family: "Rokkitt";
font-weight: 400;
padding: 5px 3px 10px;
color: #333;
text-align: center;
}
<div class="blocks">
<div class="heading">
<a href="">
<h3>Featured Deals</h3>
<p>Hand selected by our creative director</p>
</a>
</div>
<div class="grid">
<a href="details.html">
<div class="grid p7"></div>
</a>
<a href="details.html">
<div class="grid p7"></div>
</a>
<a href="details.html">
<div class="grid p7"></div>
</a>
<a href="details.html">
<div class="grid p7"></div>
</a>
<a href="details.html">
<div class="grid p7"></div>
</a>
<a href="details.html">
<div class="grid p7"></div>
</a>
<a href="details.html">
<div class="grid p7"></div>
</a>
<a href="details.html">
<div class="grid p7"></div>
</a>
</div>
</div>