shapper wrote:
Where can I find some information on nesting rules?
http://www.w3.org/TR/html4/sgml/dtd.html
Not the easiest thing to learn to read though! (search for "DTD
introduction" or something)
Can I include a <divinside a <span>?
No. Here's a small snippet of the DTD
<!--
HTML has two basic content models:
%inline; character level elements and text strings
%block; block-like elements e.g. paragraphs and lists
-->
Actually there's a third one too %flow;, which comprises both %inline;
and %block; elements
<!-- %inline; covers inline or "text-level" elements -->
<!ENTITY % special
"A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO">
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; |
%formctrl;">
So we see from this that <spanis one member of %inline; and also of
%flow; (see below)
<!ENTITY % block
"P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">
<!ENTITY % flow "%block; | %inline;">
We see here that <divis one member of %block; and thus of %flow; but
NOT %inline;
<!ELEMENT SPAN - - (%inline;)* >
<!ELEMENT DIV - - (%flow;)* >
<spancan contain anything from %inline;
<divcan contain anything from %block; or %inline;
So <divcan contain <span>, but <spancan't contain <div>
Now see if you can read the DTD yourself and see where <pfits into
all this.