Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where in the world are are the HTML nesting rules? [closed]

Can someone provide a link to a document that has all HTML (preferably HTML5) nesting rules?

For example: you can't put a <div> inside a <p>.

Thanks!

like image 795
trusktr Avatar asked May 13 '11 20:05

trusktr


People also ask

Is nesting allowed in HTML?

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

What is the name of the HTML tags that do not have closing tag ie</>?

The void elements or singleton tags in HTML don't require a closing tag to be valid. These elements are usually ones that either stand alone on the page ​or where the end of their contents is obvious from the context of the page itself.

What is the closing tag for HTML?

An opening tag begins a section of page content, and a closing tag ends it. For example, to markup a section of text as a paragraph, you would open the paragraph with an opening paragraph tag <p> and close it with a closing paragraph tag </p> (closing tags always proceed the element with a /).


2 Answers

See the HTML 5 specification. Take, for example, the p element.

The Content Model will tell you what it can contain. In this case: "Phrasing content.", which links to a list of elements interspersed with exceptions.

like image 167
Quentin Avatar answered Sep 28 '22 12:09

Quentin


Not. Html5, but http://www.cs.tut.fi/~jkorpela/html/nesting.html is a useful list in the form I think you want. Absurdly complicated....

like image 33
Stephen Todd Avatar answered Sep 28 '22 12:09

Stephen Todd