[RESOLVED]html block elements and text (or inline) elements

Morning ;-)

In general, html block elements can be nested. But the below is not valid html

<p>
  <table>
  ....
  </table>
</p>

A p-element can not contain a table-element although both are block level elements.

www.w3.org has the specifications, but it’s a bit of a mission to dig through them.

I’m looking for a web page or document that provides a list of the block elements and the text elements . The special requirement is that it must tell me if an element can be nested (and in which elements it can be nested). Is anybody aware of such a list?
Some searching did not reveal anything (but as usual, I might have used the wrong search terms). I’m pretty sure that there was one on the web 15 years ago ;-)

Hi wim sturkenboom,

Thanks for your post.

HTML (Hypertext Markup Language) elements are usually "block-level" elements  or  "inline" elements.
Generally, block-level elements may contain inline elements and other block-level elements.

wim sturkenboom

I’m looking for a web page or document that provides a list of the block elements and the text elements .

You could refer to the following links which will show you a complete list of all HTML block level elements and inline elements.

Hope it will be helpful to you.

Best Regards,

Fei Han

Thanks for the reply. I quickly glanced over it seems to provide the same information (but with a different format) as the w3 pages. Not what I was looking for (but bookmarked).

wim sturkenboom

A p-element can not contain a table-element although both are block level elements.

<p> element is a special kind of block level element which usually contains blocks of texts. You can use any of the tags related to texts (such as <b>, <i> etc.) inside the <p> tags. 

wim sturkenboom

he special requirement is that it must tell me if an element can be nested (and in which elements it can be nested). Is anybody aware of such a list?

Does this help? https://www.cs.tut.fi/~jkorpela/html/nesting.html

Ruchira

Does this help? https://www.cs.tut.fi/~jkorpela/html/nesting.html

Yes, that is basically what I was looking for. Thanks.

Leave a Reply