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!
HTML elements can be nested (this means that elements can contain other elements). All HTML documents consist of nested HTML elements.
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.
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 /).
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.
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....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With