Here is my code
#example {
border:1px solid black;
padding:0;
}
<div>
<p id="example">paragraph line 1<br>
paragraph line 2<br>
paragraph line 3<br>
paragraph line 4</p>
</div>
This will result to the paragraph having 0 padding top and bottom. However, if I put the id="example"
on the div like this,
#example {
border:1px solid black;
padding:0;
}
<div id="example">
<p>paragraph line 1<br>
paragraph line 2<br>
paragraph line 3<br>
paragraph line 4</p>
</div>
it will result with the paragraph having padding on the top and bottom. Why does it yield different result despite declaring both id="example"
a padding of padding:0;
?