0

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 -->
Enlico
  • 23,259
  • 6
  • 48
  • 102

2 Answers2

2

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 -->
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Well, the trick of coloring proves your point unequivocally. Now I just wander what in my use case is so "wrong". – Enlico Jan 06 '22 at 08:44
  • 1
    Ask the people who wrote the spec in the '90s. – Quentin Jan 06 '22 at 08:44
  • 1
    By the way, is _The start of the blockquote element will implicitly end the p element_ written somewhere in the standard? – Enlico Jan 06 '22 at 08:48
  • 2
    https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element - see the tag omission section for the p element. – Quentin Jan 06 '22 at 08:49
  • Fantastic, not even a `ul` can be in a `p`. What a silly design from the '90s. – Enlico Jan 06 '22 at 08:53
-1

See the standard on how blockquote is intended. Inside a quote p are allowed but not vice versa. You could use a blockquote inside an article or section however.

Having said that. I don't believe any browser out there minds you doing whatever you like. Browsers are like that.

theking2
  • 2,174
  • 1
  • 27
  • 36
  • 1
    All browsers mind. – Quentin Jan 06 '22 at 08:40
  • try this

    Lewis Caroll wrote:

    Twas brillig, and the slithy toves Did gyre and gimble in the wabe; All mimsy were the borogoves, And the mome raths outgrabe.

    Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!

    – theking2 Jan 06 '22 at 08:44
  • Well, Quentin's snippet shows that browsers do care. – Enlico Jan 06 '22 at 10:34
  • Indeed.

    within a works but a new

    will close a preceding

    . Perheps one reason is that > tags are less important. to name a few are all redundant and can be omitted as it is clear when they were left out. (

  • implicitly closes the preceding
  • ) A clever design from the '20-ties
  • – theking2 Jan 13 '22 at 19:54