Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of HTML5 elements that can be nested inside P element?

Tags:

html

nested

I am trying to figure all the valid HTML5 elements that can be nested inside paragraph elements such that w3 validator doesn't show any errors. I mean I am trying to figure all tags that can replace the dots in the following code such that w3 validator doesn't show any errors:

<p>...</p> 

Is there such a list available? I tried searching on Google without any luck.

Even if the converse list is available, i.e. elements that can not be nested inside paragraph elements, it is good enough for me.

like image 656
Lone Learner Avatar asked Mar 24 '12 13:03

Lone Learner


People also ask

Which elements can be nested in HTML?

Nested HTML Elements HTML elements can be nested (this means that elements can contain other elements). All HTML documents consist of nested HTML elements.

What tags can be used inside p tag?

The p tag. This tag defines a paragraph of text. It's a block element. Inside it, we can add any inline element we like, like span or a .

Can P elements be nested?

You cannot nest P elements it is illegal. The P element represents a paragraph.

Can we use P tag inside p tag in HTML?

No, a paragraph element may not contain other block elements. A paragraph tag is intended for a block of text.


1 Answers

The HTML5 spec tells us that the <p> element's content model is phrasing content. Phrasing content is defined by the spec:

3.2.5.1.5 Phrasing content

Phrasing content is the text of the document, as well as elements that mark up that text at the intra-paragraph level. Runs of phrasing content form paragraphs.

  • a (if it contains only phrasing content)
  • abbr
  • area (if it is a descendant of a map element)
  • audio
  • b
  • bdi
  • bdo
  • br
  • button
  • canvas
  • cite
  • code
  • command
  • datalist
  • del (if it contains only phrasing content)
  • dfn
  • em
  • embed
  • i
  • iframe
  • img
  • input
  • ins (if it contains only phrasing content)
  • kbd
  • keygen
  • label
  • map (if it contains only phrasing content)
  • mark
  • math
  • meter
  • noscript
  • object
  • output
  • progress
  • q
  • ruby
  • s
  • samp
  • script
  • select
  • small
  • span
  • strong
  • sub
  • sup
  • svg
  • textarea
  • time
  • u
  • var
  • video
  • wbr
  • text
  • like image 187
    Matt Ball Avatar answered Sep 22 '22 10:09

    Matt Ball