Why do nested html paragraphs break CSS?

I tried something silly today… to find that it didn’t work, here’s what:

<p>
     <p>Title</p>
     <p>Description</p>
</p>

I thought that by nesting p-tags I would have text that was indented much like a blockquote but with my p-tag CSS attributes. It didn’t work because before CSS styles can be applied, the HTML has to be valid and as it turns out, nested paragraphs are not possible because when an HMTL parser sees two p-tags it interprets them as 2 paragraphs following each other, extra closed p-tags are ignored as errors. Do not do this.

Back to Blog

Say Hello

You can reach me by email, I'd love to hear from you.