div {
background: gray;
width: 200px;
height: 200px;
}
p {
margin-top: 24px;
margin-bottom: 24px;
color: white;
padding: 5px;
width: 100px;
}
.one {
background: orange;
outline: 2px solid blue;
}
.two {
background: lightskyblue;
outline: 2px solid red;
}
<div>
<p class="one">Paragraph One</p>
<p class="two">Paragraph Two</p>
</div>
Why is the margin collapsing for the first paragraph? i.e. why is the first paragraph touching the div container?