This page contains the nitty-gritty information which underpins the Interactive Nesting Tester and the Valid Parent and Child information stated in the reference page for each element.
Groups of XHTML 1.1 elements are formed into nesting groups and then compound nesting groups are also defined, which contain other groups (Ref: the content model in the *XHTML 1.1 Document Model Module). Once these groups have been established, the allowed content (Content Model) of any element is specified in terms of these groups and/or individual elements and/or #PCDATA.
The content models are expressed using a standard syntax, similar to regular expression syntax or Extended Backus-Naur Form, where briefly:
The following list defines the content models for compound nesting groups.
The following list defines the content models for nesting groups which contain elements.
h1 | h2 | h3 | h4 | h5 | h6 )ul | ol | dl )div | p )blockquote | pre | address )hr )form )fieldset )table )span | br )em | strong | q | cite | abbr | acronym | code | var | kbd | samp | dfn )big | small | sub | sup | i | b | tt )bdo )object | img | map )label | input | textarea | select | button )a )ruby )ins | del )script | noscript )meta | link | style | script | object )Below are listed the Content Models for all XHTML 1.1 elements, but first some words on elements with no content.
Elements which are declared with a Content Model of EMPTY must have no content whatsoever,
not even whitespace or comments.
This may be achieved either using the recommended empty-element tag, e.g. <, or by
using an end-tag immediately following the start-tag, e.g. br />< (ref:
*XML 1.0 Start-Tags, End-Tags, and Empty-Element Tags).
It is recommended always to use the empty-element tag syntax, which is also recognised by HTML user agents, for these elements.br></br>
Note: the whitespace prior to the slash in the empty-element tag may validly be omitted (giving, for example
<) but it should be retained if compatibility with HTML is desired.br/>
Conversely, elements which are not declared with a Content Model of EMPTY
should open with a start-tag and close with an end-tag (e.g. <).
There are many elements with a non-p>Paragraph Text</p>EMPTY Content Model which may validly contain no content
(e.g. the p element) and the XML specification allows the
empty-element tag to be used (e.g. <) if such an element has no content. It is recommended, however, always to
use a start-tag and end-tag (e.g. p /><) for non-p></p>EMPTY elements
which contain no content, especially if compatibility with HTML is desired.
For a simple life: If all you want to do is test whether or not one element can be a child of another, why don't you try using the Interactive Nesting Tester?
Note: Any element which is not declared as EMPTY may additionally
contain whitespace and/or comments in its content.
a Content Modelabbr Content Modelacronym Content Modeladdress Content Modelarea Content ModelEMPTYb Content Modelbase Content ModelEMPTYbdo Content Modelbig Content Modelblockquote Content Modelbody Content Modelbr Content ModelEMPTYbutton Content Modelcaption Content Modelcite Content Modelcode Content Modelcol Content ModelEMPTYcolgroup Content Modelcol*dd Content Modeldel Content Modeldfn Content Modeldiv Content Modeldl Content Modeldt | dd )+dt Content Modelem Content Modelfieldset Content Modellegend | Flow.mix )*form Content Modelfieldset )+h1 - h6 Content Modelhead Content Modelbase, HeadOpts.mix*, title, HeadOpts.mix* ) | ( title, HeadOpts.mix*, ( base, HeadOpts.mix* )? ) )hr Content ModelEMPTYhtml Content Modelhead, bodyi Content Modelimg Content ModelEMPTYinput Content ModelEMPTYins Content Modelkbd Content Modellabel Content Modelinput | select | textarea | button | InlStruct.class | InlPhras.class | InlPres.class | I18n.class | Anchor.class | InlSpecial.class | Misc.class )*legend Content Modelli Content Modellink Content ModelEMPTYmap Content Modelarea )+meta Content ModelEMPTYnoscript Content Modelobject Content Modelparam )*ol Content Modelli+optgroup Content Modeloption+option Content Modelp Content Modelparam Content ModelEMPTYpre Content Modeltt | i | b | script | map )*q Content Modelrb Content Modelrbc Content Modelrb+rp Content Modelrt Content Modelrtc Content Modelrt+ruby Content Modelrb, ( rt | ( rp, rt, rp ) ) ) | ( rbc, rtc, rtc? )samp Content Modelscript Content Modelselect Content Modeloptgroup | option )+small Content Modelspan Content Modelstrong Content Modelstyle Content Modelsub Content Modelsup Content Modeltable Content Modelcaption?, ( col* | colgroup* ), ( ( thead?, tfoot?, tbody+ ) | tr+ )tbody Content Modeltr+td Content Modeltextarea Content Modeltfoot Content Modeltr+th Content Modelthead Content Modeltr+title Content Modeltr Content Modelth | td )+tt Content Modelul Content Modelli+var Content Model