I am encountering a bit of confusion regarding the margin when implementing the following code:
Section {
background-color: #FFFFFF;
width="100%";
}
p1 {
font-family: Roboto;
font-size: 22px;
font-height: 1px;
margin-top: 45px;
margin-left: 165px;
}
p2 {
font-family: Roboto;
font-size: 22px;
font-height: 1px;
margin-top: 10px;
margin-left: 165px;
}
<section>
<p class="p1"> Content 1 </p>
<p class="p2"> Content 2 </p>
</section>
However, upon omitting the display property, the background in the section does not cover all the content. When I add display: inline-block, the background covers the content but I encounter a similar issue when switching between display:inline-block
and display: inline
or display:block
. Could someone please explain to me what is happening?