New course! Every coder should learn Generative AI!
Try a free lesson+ 2
A <p> paragraph element can only contains inline elementd.
A <p> paragraph element is of type block...
So, a <p> cannot be in a <p> nor have a <p> inside it.
Anyway, html us permissive, and browers are intented to try theur best even if the html code is not valid:
<p class="myclass">hello
<p>world</p>
!
</p>
... is interpreted as the valid code:
<p class="myclass>hello</p>
<p>world</p>
<p>!</p>
... where no <p> is child of another p. So, class 'myclass' is only applied to the first part of the breaked <p> (only to 'hello', not to 'world' nor to '!' ^^