Paragraphs are intended for textual content, not sectional content. For that reason, we do not nest other block level elements inside a P element.
For the record, let’s see what happens when we try to validate the above code, but we have to first wrap it in valid HTML.
<title>Is a DIV in a P valid HTML?</title>
<p>This paragraph is somehow both inside and outside the "div" elements. <div>Div inside the paragraph.</div></p>
<div> Test of Div. Curious if I can have more than one.</div>
As expected, it raised an Error…
Error: No p element in scope but a p end tag seen.
The reason for this error is that HTML will arbitrarily close a P element if it encounters another block, such as a P or a DIV or UL, etc. As far as the browser is concerned, the paragraph ended after the first period (full stop).
I haven’t tested this in a browser yet but expect something along these lines (font size ignored)…
This paragraph is somehow both inside and outside the "div" elements.
Div inside the paragraph.
Test of Div. Curious if I can have more than one.
Notice the line spacing. Headings and paragraphs have by default a blank line separating them from what’s above and what’s below, but DIVs do not.