Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it ok if a blockquote happens to be in a paragraph <p> tag?

I’ve read Must blockquotes contain paragraphs or must paragraphs contain blockquotes?, so I see why blockquotes can contain p elements themselves. However, I feel that this, in principle, shouldn’t exclude that a blockquote can happen to be in a p elements; after all, the ps inside the blockquote are the paragraphs relative to the quoted text, but why couldn’t the quoted text be part of a bigger paragraph of the containing document?

See the following

<p>This is a paragraph</p>

<p> This is another paragraph: with a &lt;blockquote&gt; in it
<blockquote>some long quote</blockquote>
which (notice the lower case <i>w</i>) I write something about here, so it makes sense I'm not starting a new parapgraph, imho.
</p> <!-- this very editor highlights "p>" in red -->

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Is it ok if a blockquote happens to be in a paragraph <p> tag?

No.

The start of the blockquote element will implicitly end the p element.

This is why the end tag for the p element is shown is red: There’s no matching start tag for it because the element is already closed.

p { background: yellow; }
<p>This is a paragraph</p>

<p> This is another paragraph: with a &lt;blockquote&gt; after it
<blockquote>some long quote</blockquote>
and this isn't inside a paragraph as you can tell because the CSS doesn't give it a yellow background
</p> <!-- this very editor highlights "p>" in red -->
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading