I have two divs: .content
and .main-section
, the second inside the first. I am adding a margin-top
to .main-section
and I expected to see part of .content, but it seems this has a margin-top
too. Why this behavior? and How to create a margin between .content
and .main-section
?
body {
margin: 0;
}
.content {
min-height: 100vh;
background: peru;
}
.main-section {
background: red;
height: calc(100vh - 30px);
margin-top: 30px;
}
<div class="content">
<div class="main-section">
<p class="parragraph"> parragraph </p>
<p class="parragraph"> parragraph </p>
</div>
</div>