I am confused by the unexpected output I am seeing. I had set the paragraph elements to be 100px away from all sides, but it seems that they are not positioned correctly in relation to the main
element. The top and bottom margins of the main
element are causing it to move down by 100px, which is different from what I expected in the horizontal direction.
Can anyone explain why this is happening?
main {
background-color: aqua;
width: 50%;
}
p {
background-color: #444;
margin: 100px;
}
<main>
<p>This is a paragraph.</p>
<p>This is <span class="opposite">another</span> paragraph.</p>
</main>