Second code is incorrect, since <p> tag cannot contain other block elements, which <div> is. Therefore, I assume your first code should be ok. However, it is hard to say without knowing what you're trying to do. First code is at least valid, while the second one is not.
<p> is short for paragraph. A <p> should be used to enclose each paragraph of text.
<div> is short for division. If you divide your document into logical sections, each division should be marked up as a <div>. A <div> can thus enclose one or more paragraphs (or other block-level elements), a paragraph can't enclose a <div>.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.